Opened 11 years ago

Closed 11 years ago

#21617 closed Bug (needsinfo)

Impossible to change the language settings with a logged user

Reported by: stunaz@… Owned by: nobody
Component: Internationalization Version: 1.6
Severity: Normal Keywords: Internationalization
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello, using

django.views.i18n.set_language()

I am not able to change the current language settings. It is always set to 'en' once the user is logged, no matter what I have in my LANGUAGE_CODE or what is in the request header (accept language from the browser).

I use the form as described in the documentation (This little snippet was working with django 1.5.4.) :

<form action="{% url 'set_language' %}" 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 }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>
    {{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
</select>
<input type="submit" value="Go" />
</form>

And it is not working, the language remain 'en'.
I followed the code, this line is executed from django.views.i18n.set_language()

request.session['django_language'] = lang_code

but afterward, it looks like it's overwritten somewhere.

Event setting manually the 'django_language' in the session, does not solve the problem.

Updating django to 1.6.1 does not solve the problem as well.

Change History (1)

comment:1 by Claude Paroz, 11 years ago

Resolution: needsinfo
Status: newclosed

I guess that having a small test project to reproduce this would be useful.

Note: See TracTickets for help on using tickets.
Back to Top