Ticket #13602: django_language.path

File django_language.path, 1.2 KB (added by ablis, 14 years ago)
Line 
1diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
2index b528f8e..524f29d 100644
3--- a/django/utils/translation/trans_real.py
4+++ b/django/utils/translation/trans_real.py
5@@ -336,7 +336,7 @@ def get_language_from_request(request):
6 supported = dict(settings.LANGUAGES)
7
8 if hasattr(request, 'session'):
9- lang_code = request.session.get('django_language', None)
10+ lang_code = request.session.get(settings.LANGUAGE_COOKIE_NAME, None)
11 if lang_code in supported and lang_code is not None and check_for_language(lang_code):
12 return lang_code
13
14diff --git a/django/views/i18n.py b/django/views/i18n.py
15index 2078649..2b9adcf 100644
16--- a/django/views/i18n.py
17+++ b/django/views/i18n.py
18@@ -30,7 +30,7 @@ def set_language(request):
19 lang_code = request.POST.get('language', None)
20 if lang_code and check_for_language(lang_code):
21 if hasattr(request, 'session'):
22- request.session['django_language'] = lang_code
23+ request.session[settings.LANGUAGE_COOKIE_NAME] = lang_code
24 else:
25 response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code)
26 return response
Back to Top