Adding a link inside translated content in Twig template

Viewed 16623

Inside a Twig template I would need to have a translated text that contains a link (the path should be generated by the Router, not statically embedded). Twig does not allow to render a variable inside a trans block - I'm also aware of the following:

{% trans with {'%name%': 'Fabien'} from "app" %}
Hello %name%
{% endtrans %}

but I can't see how to use that to inject inside the translation a piece like this

<a href="{{ path('privacy') }}">privacy policy</a>

(of course, the anchor text should be translated as well)

4 Answers
Related