symfony translation twig code example
Example 1: twig trans
# Definte default translation domain for twig file
{% trans_default_domain 'app' %}
# Translate string
{% trans %}Hello User{% endtrans %}
# Translate string with variables
{% trans with {'%name%': 'Fabien'} from 'app' %}Hello %name%{% endtrans %}
# Translate string using alternate domain and no variables
{{ translated.string.here |trans({}, 'alternate') }}
Example 2: symfony twig source
{# Output template as-is, without parse #}
{{ source('path/to/template.html.twig') }}