In a Django template, I need to transanlate some strings to a specific language (different from current one).
I would need something like this:
{% tans_to "de" "my string to translate" %}
or
{% blocktrans_to "de" %}my bloc to translate {% endblocktrans_to %}
to force translation to German.
I know I can call the following code in a view:
gettext.translation('django', 'locale', ['de'], fallback=True).ugettext("my string to translate")
Do I need to create a specific template tag ? Or does it already exist a dedicated tag in Django ?
templatetags/trans_to.py:
html:
result: