Translate

<h1>{{ 'Hello world'|t }}</h1>
<div class="mt-3 alert alert-warning">
    <p>{% trans %}Do you know how translation works?{% endtrans %}</p>
</div>

Using translate function with parameters:

{{ 'Last checked: @time ago'|t({'@time': time}) }}

 

 

{{ "Text to translate"|t({}, {'context' : 'Context name'}) }}

and

{% trans with {'context': 'Context name'} %} Text to translate {% endtrans %}

Test trans tag with context and a specified language.

{% trans with {'context': 'Lolspeak', 'langcode': 'fr'} %}
  Hello new text.
{% endtrans %}

Translate link text: 

{{ link('register'|t, 'route:user.register', {'id': 'kitten'}) }}