Welcome Guest, Not a member yet? Register   Sign In
Fce setLocale() does not work properly on the server

I use the setLocale () function to set the language of the error messages.

it works well on localhost (win, xampp), but not on server (unix).

in app.php is set:
PHP Code:
public $defaultLocale 'en';
$supportedLocales = ['en''cs']; 

in controler is set:
PHP Code:

On localhost is error messages in 'cs', but on server only in 'en'.

I listed the request
PHP Code:
after the setLocale() and the localhost is
["locale":protected]=> string(2) "cs"
on the server is
["locale":protected]=> string(2) "en"

please, give me an advice

What's the value of $negotiateLocale? Maybe it switch to EN because it auto-detect the language.
Maybe take a look at my tutorial for multilingual website with CI4. It covers the basics and a little more: https://includebeer.com/en/blog/creating...r-4-part-1
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/

(This post was last modified: 10-06-2021, 12:14 AM by PeVal.)

Thank you for the information.

I found out it was my fault.
I had in "Config / App.php" on "localhost"
public $ supportedLocales = ['en', 'cs'];
but on the server only
public $ supportedLocales = ['en'];

Theme © iAndrew 2016 - Forum software by © MyBB