Skip to content

LocaleProvider should respect LocaleSwitcher #748

Open
@jontjs

Description

@jontjs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions