tobias47n9e
tobias47n9e

Reputation: 2231

Set Symfony translation domain for whole bundle

Is it possible to set the Symfony default translation domain for the whole bundle? By default a bundle uses the messages domain, which apparently breaks overriding the translations in Symfony > 4 (https://github.com/symfony/symfony/issues/40014). Probably overriding works if the whole bundle has a domain like my-bundle.<Translation file extension>. Which can be overridden in the app-project in translations/my-bundle.xliff.

Or do you need to insert e.g. {% trans_default_domain 'FOSUserBundle' %} into every single .twig file as seen in this bundle: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/views/Registration/register_content.html.twig (Furthermore it also needs to be set before every call to the translator in controllers and services).

Preferably this could be set in the bundle class somewhere:

class MyBundle extends Bundle {}

Upvotes: 0

Views: 296

Answers (0)

Related Questions