schingeldi
schingeldi

Reputation: 910

Symfony2 trans_default_domain is not working

At the end of http://symfony.com/doc/current/book/translation.html#twig-templates I read about

{% trans_default_domain "app" %}

to set a translation domain for a whole template. But for me it does not work. Calling

app/console translation:extract de --dir=src/ --output-dir=app/Resources/translations --output-format=xliff --keep

Just puts all messages in the messages.de.xliff file.

But if I set the domain manually for a given label like

{{ label.name|trans({}, 'app') }}

And execute the same extract command as above, then I get a new file app.de.xliff

Is there anything more to do when using trans_default_domain?

Upvotes: 2

Views: 7144

Answers (2)

Pi Wi
Pi Wi

Reputation: 1085

{% trans_default_domain "app" %}

That's working fine, but you should clear your cache if the translation files didn't exist before to get it working.

Upvotes: 3

aeh
aeh

Reputation: 51

It seems that you forget simple quot, try this instead

{{ 'label.name'|trans({}, 'app') }}

or this

{{ 'label.name'|trans }}

Upvotes: 5

Related Questions