Problem/Motivation
Twig {%trans%} token supports some variables which are turned into tokens in the translated string using the @ prefix.
It doesn't support functions, for complexity reasons.
For urls, we need to use a variable and then render it. e.g.
{% set url = render_var(url('system.admin.content')) %}
<div>
{% trans %}<a href="{{ url }}">Content admin</a>{% endtrans %}
</div>
When this is parsed, the resulting call to t uses the @ prefix for the url, when it should use the : prefix, which is for urls.
Proposed resolution
Investigate adding support for parsing the url function to twig translation token parser and twig translation node.
Comments
Comment #5
fabianx commentedI personally would scope that differently:
Make it possible to specify the placeholder type used, e.g.
or
should be way simpler to parse, then parsing full function calls, etc.
That said I thought we supported '!' already, but I am not sure ...
Comment #6
fabianx commented