Description
Since Symfony 6.1, it has been possible to run a portion of code in a specific locale, and as of Symfony 6.4 to render emails in a specific locale, but the LocaleProvider
doesn't seem to respect either of these.
My situation is that I am using the Translatable extension on an e-commerce website, and need to send order-confirmation emails that use the localized names of the entities. When I use either of the new Symfony features, my email template as a whole DOES see use the locale specified. However when I rely on this bundle's proxyCurrentLocaleTranslation()
method to translate a translatable
entity's property in the template, the locale used is en
rather than the one I specified (en_GB
or de_DE
). On digging through the code, I think this stems from the LocaleProvider
's provideCurrentLocale()
method
regards,
Jon