Hi guys, I'm developing a website in three languages: English, Spanish and Italian. I let users change language through a select field
<form action="/i18n/setlang/" method="POST" name="language_form"> {% csrf_token %} <select id="language" name="language" onchange="document.language_form.submit();"> {% for language in LANGUAGES %} {% if language.0 == LANGUAGE_CODE %} <option selected="selected" value="{{language.0}}">{{language.1}}</option> {% else %} <option value="{{language.0}}">{{language.1}}</option> {% endif %} {% endfor %} </select> </form> For use i18n_patterns I added this statement in my settings TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.i18n', ) and added some urls to the urlpatterns with the i18n_patterns function in this way: urlpatterns = patterns( ... url(r'^i18n/', include('django.conf.urls.i18n')), ... ) urlpatterns += i18n_patterns('', # other urls i need to translate ) Now, if I go to the home (www.mysite.com) in get the url www.mysite.com/en (english is default language), and contents are translated in english (due to trans statement in templates). If I go to www.mysite.com/it/ writing the url in the address bar, contents are translated in italian, the selected option in select field is Italian and so on (it seems it works correctly!). BUT if I change the language though the select field (for example from spanish to italian) apparently doesn't happen nothing: the page is reloaded with the old language (spanish), but if I delete the language prefix from the address bar (calling www.mysite.com), when the page is reloaded I obtain www.mysite.com/it/, it seems the view work for a half or something. Before to use the language prefix in the urls, the language change work correcly, so there is something that doesn't work properly. I think it is cause of the prefix in the url, because the set_language view make a redirect to the same page (with the old address and not with the new). Am I missing something? How do you deal with this? Thanks in advance -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/2S_QskcUfXsJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.