whitebear
whitebear

Reputation: 12423

Set translation domain for every twig

I have some twigs include the text which needs to be translated.

Currently I put this sentence in every twig.

{% trans_default_domain 'AcmeTopBundle' %}

However it is a little bit bothering.

Is there a good way to set default domain for every twigs in one place??

Upvotes: 5

Views: 4263

Answers (1)

connorhu
connorhu

Reputation: 11

You can write a custom node visitor based on the original Symfony\Bridge\Twig\NodeVisitor\TranslationDefaultDomainNodeVisitor:

https://gist.github.com/connorhu/3254272188d81d1f9d7322dbdebeb0e0

Upvotes: 1

Related Questions