Localize date wit multilanguage

I have multilanguage set up like this:

c::set('languages', [
  [
    'code'    => 'en',
    'name'    => 'English',
    'locale'  => 'en_US.UTF8',
    'url'     => '/en',
  ], [
    'code'    => 'de',
    'name'    => 'Deutsch',
    'default' => true,
    'locale'  => 'de_DE.UTF8',
    'url'     => '/',
  ]
]);

c::set('date.handler', 'strftime');

However, when I use $page->date('%B') I always get the english month.

I think this is a server problem. Try:

'locale'  => 'de_DE.UTF-8'

or

'locale'  => 'de_DE.utf8'

Also, check if your server has the de_DE.utf8 language pack installed.

Ah! Okay, after checking with locale -a and setting it to the proper locale, which is indeed de_DE.UTF-8, it works. :slight_smile:

1 Like