Change date() localization for non-English sites

Hey there!

My problem is: I want to have the correct german localized for dates like the following:

{{ blog_post.date|date("l, d. F Y") }}

Like in the docs ( http://learn.getgrav.org/content/multi-language#set-locale-to-the-active-language ) I thought, i could simply set

languages:
   override_locale: true

and add “de” to the supported languages. But this didn’t work. I also don’t want any other language! The entire site is on german. So i don’t need multi-language support.

Do I really manually translate the months, weekdays, etc. like in the Tutorial ( http://learn.getgrav.org/cookbook/twig-recipes#displaying-a-translated-month ) when PHP support already those translations?

Because it would be very ugly slicing that date filter into multiple filters & translate them all separately.

1 Like

To be honest i’ve not done a lot of date handling in other languages. Really hoping someone else can pipe in with some advice for you :slight_smile:

Would be awesome!
I would like to solve this problem myself. But i didn’t found comparable questions…

Hi - same interesting issue here, I’ve created my translations into the user/config/languages so now I have only my language in the folder. in the theme template i also tried with language.yaml containing only my language and also created a language folder. still no luck with seeing translations on the website.

I asssume this only works if Twig were to use strftime() instead of date(), at least the PHP date() doesn’t support outputting the date in other languages. (See also this StackOverflow post)

strangely enough, it seems that the date and time are translated in my language :slight_smile: … I have played quite a while but its working now (can’t remember what exactly did it but you can check the files at github.com/johnmica/testsite