I have a variable my_variable
which can be onlye one of two values ("Swedish" or "English"). Then why can't I do this {% trans "{{ my_variable|capfirst }}" %}
? How should it be done? I want to translate the variable but it doesn't come out right.
How to translate a variable with django?
1.6k views Asked by Niklas Rosencrantz At
2
There are 2 answers
0
On
Just use the
{% blocktrans %}
tag to include variable for translation.For more detailesFollow this link with search blocktrans keyword.
{% blocktrans with amount=article.price %}
That will cost $ {{ amount }}.
{% endblocktrans %}
It may help you.Thank you.
or
django translate variable content in template