Translate dates

#1

Hey together,

In Kirby 2 it was possible to translate dates by adding this to the config file and the template:

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

<?= strftime ($article->date('%d %B %Y')) ?>

In Kirby 3 I did the same:

<?php
return [    
    'date.handler' => 'strftime',
    'locale' => 'de_DE.utf-8',    
];

<?= strftime ($article->date()->toDate('%d %B %Y')) ?>

But this only works if I set languages=> ‘true’; and add German as a primary language. Any Ideas of how I can archive this without adding languages?

Have great weeken everyone :slight_smile:
Florian

0 Likes

#2

That should actually work, I tested it as I said here Setlocale for non multilanguage sites

Sure your locale is set correctly? Check with locale -a in CLI

0 Likes

#3

Yes, locale is set correctly.
EDIT: OK I just updated to the newest Kirby version and it works … strange :smiley:

0 Likes