mcamara / laravel-localization

Easy localization for Laravel
MIT License
3.36k stars 512 forks source link

Localization not working in 1st reload Laravel #886

Closed audentodigital closed 8 months ago

audentodigital commented 10 months ago

Once I click on the language switcher the URL changes but the website content is updated in the 2nd reload. Why?

More info:

Version of Laravel : 10 Version of the Laravel-localization package : 1.8 Which middleware is used in Route::groups : 'localize','localeSessionRedirect', 'localizationRedirect', 'localeCookieRedirect' Copy of the config file ( or at least setting of supportedLocales : all, useAcceptLanguageHeader : true and hideDefaultLocaleInURL:false).

audentodigital commented 10 months ago

There are no cache issues, even in the local and live same issue happening

fonz-lu commented 7 months ago

Did you resolve your issue @audentodigital ? I am having the same problem.

The correct locale is displayed with LaravelLocalization::getCurrentLocale() on the first page load, but the rest is just updated on the a second reload?

Thank you

audentodigital commented 6 months ago

Yes. It was a conflict. For my case, I also created a custom middleware for Localization. Please check if you tried any other Localization solution and the older files still present in it.

fonz-lu commented 6 months ago

That was it, I still had a different localisation middelware. Thanks