CodeIgniter Forums

Full Version: supported locales (array) in .env
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:

app.supportedLocales = en,fr
app.supportedLocales = 'en,fr'
app.supportedLocales = ['en','fr']
app.supportedLocales = "['en','fr']"
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.