Hi all,
I am trying to figure out the best practice to define the locale on a global level.
Setting the locale in the config.php
like below and then use it with myfield()->toDate('l', 'intl')
still prints the English day format:
'locale' => [
'LC_ALL' => 'de_DE.utf-8',
'LC_TIME' => 'de_DE.utf-8',
],
Many thanks for your help,
Matt
Does it work correctly with the strftime
date handler?
This works for me:
In config:
'date' => [
'handler' => 'intl'
],
In template:
<?= $page->date()->toDate('EEEE') ?>
Make sure that the locale you have set is correct.
Regarding locale: Depending on your server operating system, it may as well be de_DE.UTF8
or de_DE.UTF-8
.
@lukasbestle The example in the release docs is either wrong but at least doesn’t work: Release 3.6.5 · getkirby/kirby · GitHub. The date handler cannot be passed as a second paramater to toDate()
.
Thanks for your input.
This config.php
settings work for me now (on local and live server) to get a localized date & time:
'locale' => [
'LC_ALL' => 'de_DE.utf-8',
'LC_TIME' => 'de_DE.utf-8',
],
'date' => [
'handler' => 'intl'
]
and in the template (for example to echo day name):
mydatefield()->toDate('EEEE', 'intl')
You are right. We changed the code during review and forgot to update the code example. Fixed. 
1 Like
@texnixe The Kirby team should update the date.handler docs with the config option:
'date' => [
'handler' => 'intl'
],
I definitely missed that part and was glas you mentioned it.