Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weird issue involving getInversedLocaleFromMapping #778

Open
keithwhyman opened this issue Mar 19, 2021 · 0 comments
Open

weird issue involving getInversedLocaleFromMapping #778

keithwhyman opened this issue Mar 19, 2021 · 0 comments

Comments

@keithwhyman
Copy link

I assume I have done something wrong somewhere but...
New Laravel 8 sail install
Installed laravel-localization over composer.
Created a localesMapping
'localesMapping' => [ 'en-GB' => 'uk', 'de-DE' => 'de' ],
Redirect not working, 'en' ok, 'de' is a 404
Routing in web is set up so
Route::group( [ 'prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'localize','localeSessionRedirect', 'localizationRedirect', 'localeViewPath' ] ], function() {

After looking into this I find in vendor/mcamara/laravel-localization/src/Mcamara/LaravelLocalization/LaravelLocalization.php the following.
When calling LaravelLocalization::setLocale(),
I get from
$locale = $this->request->segment(1);
"de" as expected
but then
$locale = $this->getInversedLocaleFromMapping($locale);
"de_DE"

And the next part goes wrrong
$this->supportedLocales
array:2 [▼
"de" => array:4 [▶]
"en" => array:4 [▶]
]
where obviously de_DE is not found.
If I just comment out getInversedLocaleFromMapping then all works fine.
What have I done wrong?
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant