Multiple languages in blog date

I am busy with a blog in 2 languages (NL & EN). I need to have the date of the posts also in the right language.
In the template blog_item.html.twig the date is constructed by this rule:
<span><i class="fa fa-clock-o"></i> {{ page.date|date(config.system.pages.dateformat.short) }}</span>

How should I change this rule to get the date in the right language???
Thanks.

If you want to translate months or similar, then check this

If you want to change date format only…
Well… I’m going to need this one myself and was thinking a bit, but didn’t get to implementing it yet.
Was thinking of having some kind of config of date formats for each language and then in twig use a filter. Probably a plugin would be the best solution here, combining config and twig filter using that config.

@TonHaarmans, You could try the following:

  • Create file ‘/user/translations/nl.yaml’ with content:
    DATE_FORMAT: d-m-Y
    
  • Create file ‘/user/translations/en.yaml’ with content:
    DATE_FORMAT: Y/m/d
    
  • In Twig template:
    {{ page.date|date('DATE_FORMAT'|t) }}
    

If you need months like ‘March’, April’ you should have a look at the url shared by @Karmalakas

Nice workaround :slight_smile: Will keep in mind for when I need it

Thanks all. It is not about the date-format, but indeed about the names of the months and things like 1st, 2nd, etc. The link to the documentation is not helping me much. I managed to change the names of the month in the archives, but not the date of the blog postings. If you want, have a look at Stukjes | Marjolijn Hof

I have this in my blog.html.twig template:
<span>{{ child.header.date|date('d') }} {{ 'GRAV.MONTHS_OF_THE_YEAR'|ta(child.header.date|date('n') - 1) }} {{ child.header.date|date('Y') }}</span>
You can see the result here: Blog | Servizi di traduzione e scrittura professionale | Qabiria
Months are translated, but not the date order.

Great! Works like a charm!