Setlocale for non multilanguage sites

Earlier in days I could set my locale in the config file like this
setlocale(LC_ALL, 'de_DE.utf8', 'de_DE', 'de', 'ge');
But now this don’t seam to work… I’m not sure if it is since kirby 3.1 or even earlier.

How can I set my language to the preferred locale, so with 'date.handler' => 'strftime' the dates are in the right language?

Thanks for your help.

You can set it in your index.php

Thanks, but this doesn’t solve it either.

The language seems to be set correct. but my dates are not translated. Some times this didn’t work locally, but on the production server I hadn’t any problems. Also the locale are installed on my system.

Is the strftime datehandler enabled in your config?

Yes like so: 'date.handler' => 'strftime'

I think you need to set them in your languages:

@bvdputte That doesn’t make sense for a single language website, though.

@jonathanhess I just checked the locale setting in config. There used to be a bug but it was supposed to be fixed.

Hm… I’ll check myself.

Edit: setting the locale in config.php works for me in a 3.1.0 Starterkit.


return [
    'debug' => true,
    'date.handler' => 'strftime',
    'locale' => 'de_DE.UTF-8',
1 Like

Thanks @texnixe. Didn’t know you could do it the “kirby” way. I just did it the php-way… but yes, with

return [
    'locale' => 'de_DE.UTF-8',

it works great. Thanks again.

Would be great, if this could be added to the docs, @texnixe.
Maybe here: date | Kirby CMS

With the intl date handler, you don’t need the locale anymore. Strftime is deprecated in PHP 8.1 and therefore shouldn’t be used anymore.

Note that the intl date handler had a bug, so you need to update to Kirby 3.8.x