Intl date not localized - difference between localhost / server

Hello,

I’m using the 4.6.1 of Kirby and using intl as date handler.

On my local server, the date is properly localized now (it did vary before) but on my server the text is in English and not in French.

I don’t know what to do to fix this. Everything seems fine and correctly set up.

Thank you for your help!

Have you checked if the PHP intl extension is present and enabled on your server? You might have to enable it in cPanel (or whatever management tool your provider provides). You can check the current status with phpinfo().

If it is not enabled, and you don’t find a way to enable it, contact their support.

Yes I checked, it is enabled! I’ve also run locale -a to see if French was supported and it is (fr_FR, fr_FR.utf8, etc.).

If this help, I can add that I use the Kirby starter kit.

It’s a single language site, I’ve set a locale in my config and using date()->toDate(‘d MMMM y’).

'locale' => 'fr_FR.utf8',
  'date'  => [
    'handler' => 'intl',
  ],

Try passing an IntlDateFormatter object, like this:

<?= $page->date()->toDate(new IntlDateFormatter("fr_FR", IntlDateFormatter::FULL, IntlDateFormatter::NONE, 'Europe/Berlin')); ?>

The see here for the constants you need to get the format you want: PHP: IntlDateFormatter - Manual

1 Like

Thank you very much, it’s working with this!