Get locale after Kirby 3.1.3?

I know the locale has been revamped to be used as an array in Kirby 3.1.3. But how do I get the locale now?

kirby()->language()->locale() returns array (size=1) 6 => string 'en_US.utf8' (length=10) instead of en_US.utf8.

Do I always find this on the sixth index? And what is that magic number 6 anyway?

Thanks!

The array keys are the PHP locale categories. They are constants like LC_ALL, but internally they are ints. That‘s why you get the key 6 here.

You can get the locale string with $language->locale(LC_ALL).

Thanks for the swift reply, Lukas!

You are welcome. :slightly_smiling_face: