Django template translation with variable order -
i want translate string in django template:
{% trans "thank you. may <a href=\"/logout\">log out</a> now." %}
so in english, result be:
thank you, may <log out> now.
but - example in german, need:
vielen dank. sie können sich nun <ausloggen>.
where text in <> hyperlink. problem order of words has changed, , not find way how this. did see in documentation can done in python code, "placeholders". need in templates. there way it? also, ease translation, don't html in translation file. highly appreciated!
as @fsw recommended, see this.
you should not hardcode "/logout", have use {% url "urlname" %}
tag. see here
maybe that? (i didnt test it)
{% url "logout" logoutvar %} {% blocktrans logoutvar logoutvar %} "thank you. may <a href="{{ logoutvar }}">log out</a> now." {% endblocktrans %}
Comments
Post a Comment