I came back with another problem to ask you about this.
If I have for example only one locale in the App.php config file:
PHP Code:
public $supportedLocales=['en'];
And I use the ARAmiss solution in BaseController.php:
PHP Code:
/**
* Constructor.
*/
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
// Do Not Edit This Line
parent::initController($request, $response, $logger);
config("App")->supportedLocales = ['en','fr','es','it'];
}
I expect that if for example I open "https://mysite.com/fr"
service('request')->getLocale() returns "fr" to me instead it always returns "en".
I guess it's because getLocale() always reads the configuration file App.php and not the new value set in BaseController.php. So, not finding the language in the config file, it always offers me the default one.
There is a way to fix this problem. Is there a way to get around this or do I have to abandon the system adopted by codeigniter for the management of the locale and write me something new?
I hope I was clear in my explanation.
Thanks