Under Symfony, the locale seems to change without explanation

38 views Asked by At

I have a Symfony 4 application in which I generate a PDF file using dompdf. In my twig files, I use localizeddate to display a date. I want my date to be written in French.

<div>
    Date :
    <span>{{ myCustomDate | localizeddate('long', 'none') }}</span>
</div>

I use the twig template in two different services: one called by my browser, the other using Messenger.

When I generate the PDF by using the "regular" browser way, the date is written in French.

Date : 12 décembre 2020

But when I generate it using Messenger, the date is in English.

Date : December 12, 2020

Would you know why?

0

There are 0 answers