{# Test trans tag with different filters applied to tokens. #}
{% set string = '&"<>' %}
{% trans %}
Escaped: {{ string }}
{% endtrans %}
{% trans %}
Placeholder: {{ string|placeholder }}
{% endtrans %}
{# Test trans tag with complex tokens. #}
{% set token = {'name': 'complex token', 'numbers': '12345', 'bad_text': '&"<>' } %}
{% set count = token|length %}
{% trans %}
This {{ token.name }} has a length of: {{ count }}. It contains: {{ token.numbers|placeholder }} and {{ token.bad_text }}.
{% endtrans %}
{# Test trans tag but with a context only msgid. #}
{% trans %}
I have context.
{% endtrans %}
{# Test trans tag with context. #}
{% trans with {'context': 'Lolspeak'} %}
I have context.
{% endtrans %}
{# Test trans tag with a specified language. #}
{% trans with {'langcode': 'zz'} %}
Hello new text.
{% endtrans %}
{# Test trans tag with context and a specified language. #}
{% trans with {'context': 'Lolspeak', 'langcode': 'zz'} %}
Hello new text.
{% endtrans %}
{# Tests that https://www.drupal.org/node/2489024 doesn't happen without twig debug. #}
{% trans %}
Number I never remember: ' . print(pi()) . '
{% endtrans %}