1 {# Test trans tag with string argument. #}
3 {% trans 'Hello sun.' %}
6 {# Test trans tag with string argument and context #}
8 {% trans 'Hello sun.' with {'context': 'Lolspeak'} %}
11 {# Test trans filter. #}
13 {{ 'Hello Earth.'|trans }}
16 {# Test trans tag with text content. #}
23 {# Test trans/plural tag where count = 1. #}
29 Hello {{ count }} stars.
33 {# Test trans/plural tag where count = 2. #}
39 Hello {{ count }} stars.
43 {# Test trans tag with different filters applied to tokens. #}
44 {% set string = '&"<>' %}
52 Placeholder: {{ string|placeholder }}
56 {# Test trans tag with complex tokens. #}
57 {% set token = {'name': 'complex token', 'numbers': '12345', 'bad_text': '&"<>' } %}
58 {% set count = token|length %}
61 This {{ token.name }} has a length of: {{ count }}. It contains: {{ token.numbers|placeholder }} and {{ token.bad_text }}.
65 {# Test trans tag but with a context only msgid. #}
72 {# Test trans tag with context. #}
74 {% trans with {'context': 'Lolspeak'} %}
79 {# Test trans tag with a specified language. #}
81 {% trans with {'langcode': 'zz'} %}
86 {# Test trans tag with context and a specified language. #}
88 {% trans with {'context': 'Lolspeak', 'langcode': 'zz'} %}
93 {# Tests that https://www.drupal.org/node/2489024 doesn't happen without twig debug. #}
96 Number I never remember: ' . print(pi()) . '