File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -738,18 +738,21 @@ texts* and complex expressions:
738738 variables translated using a filter. In other words, if you need to
739739 be sure that your translated variable is *not * output escaped, you must
740740 apply the raw filter after the translation filter:
741-
741+
742742 .. code-block :: jinja
743743
744744 {% message = '<h3>foo</h3>' %}
745745
746- {# no change is needed - the translated text is never escaped #}
746+ {# text translated between tags is never escaped #}
747747 {% trans %}
748748 {{ message }}
749749 {% endtrans %}
750750
751- {# With filters, you must unescape the translated text #}
752- {{ message | trans | raw }}
751+ {# a variable translated via a filter must be escaped #}
752+ {{ message | trans | raw }}
753+
754+ {# but static strings are never escaped #}
755+ {{ '<h3>foo</h3>' | trans }}
753756
754757 PHP Templates
755758~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments