python/django problem with sessions and language
Posted
by
freakish
on Stack Overflow
See other posts from Stack Overflow
or by freakish
Published on 2011-03-04T23:24:03Z
Indexed on
2011/03/04
23:24 UTC
Read the original article
Hit count: 387
Hello everyone!
I have the following problem: on the main page I can change language. New language is saved in request.session['django_language']. I also have SESSION_COOKIE_DOMAIN set to my site, so session should be inherited by subdomains. And it is, because after changing language I check request.session['django_language'] in subdomains and it's fine. Then I use
django.middleware.locale.LocaleMiddleware
to translate my pages. And it works perfectly... only on main site! If I change language and refresh main site - it is ok. However, if I change language and go to a subpage (for example /LogIn), then the page is NOT translated at all. It stays on default language. This is really strange, because if I use
{% load i18n %} {% get_current_language as lang %}
in this subpage, then lang is good language. There is no mistake. What kind of problem can it be? Some suggestions?
© Stack Overflow or respective owner