symfony2 - twig - 差异过滤器反式
symfony2 - twig - difference filter trans
我想知道 {% trans%} lorem ipsum {%endtrans%}
和 {{'lorem ipsum' | trans}}
有什么区别
并且在这种情况下使用块 {% trans%}
。
我不明白 difference.thank 你
根据 symfony 文档
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
我想知道 {% trans%} lorem ipsum {%endtrans%}
和 {{'lorem ipsum' | trans}}
并且在这种情况下使用块 {% trans%}
。
我不明白 difference.thank 你
根据 symfony 文档
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