setlocale() seems to do nothing |
Hello,
I want to give my users the option to change their locale (only for their account). I read the locale can be set by using `$this->request->setLocale('nl');`. But this still prints 'en'. PHP Code: $this->request->setLocale('nl'); And still the english language files are used. Is there a way I can dynamicly change the locale (without using the locale in the url) ?
You need to set $supportedLocales:
https://github.com/codeigniter4/CodeIgni...pp.php#L99
Thanks, that partially did the trick.
Now the getLocale() prints 'nl' instead of 'en'. Ik have placed '$this->request->setLocale('nl)' on top of my controller method. But still the english language files are loaded... If I change the $defaultLocale in Config/App.php it does switch to the NL language files.
You need to run $this->request->setLocale('nl') before calling lang().
Or set locale on Language: PHP Code: $language = Services::language(); |
Welcome Guest, Not a member yet? Register Sign In |