Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Adding "with" keyword to i18n #13

Dsls opened this Issue · 0 comments

1 participant


When using complex translations with parameters, we currently need to declare temporary variables for each parameter.

Example :

{% set name = name|capitalize %}
{% set site_url = '<a href="" alt="mysite">my website</a>' %}
{% trans %}
    Hello {{ name }}! Welcome to {{ site_url }}.
{% endtrans %}

Using a "with" syntax similar to "include" tag could be an enhancement for this :

{% trans with {'name': name|capitalize, 'site_url':'<a href="" alt="mysite">my website</a>'} %}
    Hello {{ name }}! Welcome to {{ site_url }}
{% endtrans %}

That would also enable to have a restrict context for translation (through the "only" keyword) , in the case we do not want to give access to other variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.