supported locales (array) in .env |
Hi all,
I'm trying to set the $supportedLocales into the .env file and it's not working. $supportedLocales comes as an array, so in the config file, it sould be in, for example : PHP Code: public $supportedLocales = ['en', 'fr']; But it seems that the .env file in CodeIgniter does not support arrays, am I right? I've tried various solutions, but none of them worked: Code: app.supportedLocales = en,fr Any ideas?
I don't think this is currently supported because environment variables are stored as string values. I think we can we can go through this when BaseConfig parses the env values to the child class's properties. If you have a working implementation, please feel free to submit a PR for discussion.
(08-14-2020, 07:46 AM)parisiam Wrote: Hi all, Did you find a solution instead of change app/Config/App.php file? Thanks.
@rodrigoguariento there still is no way of setting array values in .env. You could probably create your own workaround by making a new Config file with a CSV value and then a registrar to inject that into App::$supportedLocales
I also found this issue when setting Logger $threshold = [6,8,9]
There is no solution for numbered, it seems to me But we can set up an associative array https://codeigniter4.github.io/CodeIgnit...-variables probably really add indexing 0 1 2 ... PHP Code: public $supportedLocales = ['en', null, null]; .env: Code: app.supportedLocales.0 = fr I don't think there are any cases where the supported locales need to be changed depending on the environment. And I don't think we need to use $threshold like [6,8,9] in the config. A single value is sufficient.
There is a possibility, why not use it?
at that moment I do not need notices, I excluded them from the list. I tried to make treshold.0 - didn't work |
Welcome Guest, Not a member yet? Register Sign In |