Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mr_filz's avatar

Multilanguage session variable

I followed step by step this giude :

https://laracasts.com/discuss/channels/tips/example-on-how-to-use-multiple-locales-in-your-laravel-5-website

and making a multilanguage website with this packege

https://github.com/spatie/laravel-translation-loader

it's working good and really easy.

Now, the main problem is I don't want to prefix all my routes with current locale but I want to storage the current language "somewhere".

like http://website/page will redirect to http://website/en/page ALWAYS, because locale is not changing.

I tried to put a session variable in the middleware but first it's not working (or better i'm not able to make it work), second I'm sure that is not the best way to do it. Any suggestion ? Thanks

0 likes
0 replies

Please or to participate in this conversation.