user987456321 user987456321 - 3 months ago 11
PHP Question

Twig : how to translate a date filter variable?

I have a twig template where a

{{ startdate|date('d-m-Y')}}
displays
12-Aug-2016
. I want it to display the month in french, how can I do it ? It is a Symfony application.

Thanks.

Answer

I think you need to use The Intl Extension

And it would be something like that :

{{ startdate|localizeddate('none', 'none', null, null, 'EEEE d MMMM Y') }}

return mardi 9 août 2016