Repository navigation
Possible bug in Lang::handleMissingKeysUsing() #49605
Unanswered
th-alanreed
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I think I have stumbled across a small bug. Would like someone to confirm before I try creating a pull request to fix the problem.
Lang::handleMissingKeysUsing()is useful for logging missed translation keys. The third parameter of this callback is supposed to be the locale that is missing the translation. In some cases the$localeparameter is theconfig('app.fallback_locale')value instead of the currentApp::getLocale()value.https://laravel.com/docs/10.x/localization#handling-missing-translation-strings
Steps to reproduce:
In your
config/app.phpfile,'locale' => 'en'and'fallback_locale' => 'en'.In your
routes/web.php:If the key does not exist in both
frandenthen the$localeparameter of theLang::handleMissingKeysUsing()function will been. I would expect it to befr.This kind of makes sense if you are using "short keys". In that case, you should have a translation in your
fallback_locale. But if you are using JSON file translation approach there is no need for a fallback locale.All reactions