I have two bundles: AppBundle
and AnotherBundle
.
I have to translate a string in AppBundle
:
{% trans from 'anotherbundle' %}anotherbundle.string{% endtrans %}
The problem is that when I extract the strings to translate with JMSTranslationBundle, the file anotherbundle.en.xlf
is created inside the AppBundle/Resources/translations
directory while I want it to be created in AnotherBundle/Resources/translations
directory.
To extract the translations I use this command:
bin/console translation:extract en --config=app
and the configuration I use is this:
jms_translation:
configs:
app:
dirs: ["%kernel.root_dir%", "%kernel.root_dir%/../src/AppBundle/"]
output_dir: "%kernel.root_dir%/../src/AppBundle/Resources/translations"
ignored_domains: [routes, FOSUserBundle]
excluded_names: ["*TestCase.php", "*Test.php"]
excluded_dirs: [cache, data, logs, web]
How can I make JMSTranslationBundle extract the translating string into AnotherBundle
directory?
I always leave the options blank and the translations are available in every single bundle I use. I only have to refer to the domain.