0
votes

I'm using multiples translations files :

app /
  Resources /
    translations /
      messages.en.yml
      messages.fr.yml
      mailer.en.yml
      ...
src /
  AdminBundle /
    Resources /
      translations /
        admin_messages.en.yml
        ...
  PortalBundle /
    Resources /
      translations /
        portal_messages.en.yml
        ...

The translation works when (or):

  • admin_messages.en.yml is renamed messages.en.yml
  • I set the default domain in my twig files {% trans_default_domain "admin_messages" %}

Badly, I can't use the filename messages.en.yml many times and setting the default domain should not be the cleaner way

So, I'd like to override the default domain of translation from messages to admin_messages on my admin bundle.

1

1 Answers

0
votes

It looks like your case fits in How to add a new domain for translations in Symfony.

As a summary, and as stated in https://symfony.com/doc/current/translation.html#translation-resource-file-names-and-locations, you can set the default domain in a template by using {% trans_default_domain 'app' %}