i use the set_language redirect view form from the docs.
urls.py
urlpatterns += patterns('',
(r'^i18n/', include('django.conf.urls.i18n')),
)
template:
<form action="/i18n/setlang/" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="{{ redirect_to }}" />
<select name="language">
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}">{{ language.name_local }} ({{ language.code }})</option>
{% endfor %}
</select>
<input type="submit" value="Go" />
</form>
Which is the right syntax to replace the action attribute “/i18n/setlang/” with the url-template-tag?
EDIT:
I found the right url in the include (thanks to Daniel!):
<form action="{% url django.views.i18n.set_language %}" method="post">
As the documentation says, you can enter the full path of a view as the
{% url %}parameter