setLocale not working as I intended? |
(03-03-2022, 06:12 PM)kenjis Wrote: It is wired, because Sorry I don't understand your answer. It means it is not working as a global variable? should I set it in every controller? ok, it seems I've found the solution. At login or change password, I store the language variable ('it','en',etc...) into a session variable PHP Code: session()->set('user_language',$data['language']); then on BaseController.php i put this line: PHP Code: if (session()->get('user_language')){ now every page is correctly translated according to user selected language (that is stored into database user table and recovered at login). If session is not existing (i.e. user not logged in), pages are displayed with default language. |
Messages In This Thread |
setLocale not working as I intended? - by Mano - 03-03-2022, 10:20 AM
RE: setLocale not working as I intended? - by kenjis - 03-03-2022, 06:12 PM
RE: setLocale not working as I intended? - by Mano - 03-04-2022, 03:12 AM
RE: setLocale not working as I intended? - by InsiteFX - 03-04-2022, 01:39 AM
RE: setLocale not working as I intended? - by Mano - 03-04-2022, 03:11 AM
|