Reputation: 259
I wanted to know what is the difference between the {% trans%} lorem ipsum {%endtrans%}
and {{'lorem ipsum' | trans}}
and also in which case use the block {% trans%}
.
i don't understand the difference.thank you
Upvotes: 1
Views: 646
Reputation: 2106
According to the symfony documentation
Using the translation tags or filters have the same effect, but with one subtle difference: automatic output escaping is only applied to translations using a filter. In other words, if you need to be sure that your translated message is not output escaped, you must apply the raw filter after the translation filter
{# text translated between tags is never escaped #}
{% trans %}
<h3>foo</h3>
{% endtrans %}
{# strings and variables translated via a filter are escaped by default #}
{{ '<h3>bar</h3>'|trans|raw }}
http://symfony.com/doc/current/book/translation.html#twig-templates
Upvotes: 3