From bff075973a84387f2f25c223a7d9fa8ce09d104a Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sun, 6 Jul 2008 05:25:55 +0000 Subject: [PATCH] Fixed #7072 -- More logical and robust language settings in the i18n context processor. Analysis and patch from akaihola. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7843 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/context_processors.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/django/core/context_processors.py b/django/core/context_processors.py index 55c19c17e87..bde3f665d4f 100644 --- a/django/core/context_processors.py +++ b/django/core/context_processors.py @@ -38,14 +38,11 @@ def debug(request): return context_extras def i18n(request): + from django.utils import translation + context_extras = {} context_extras['LANGUAGES'] = settings.LANGUAGES - if hasattr(request, 'LANGUAGE_CODE'): - context_extras['LANGUAGE_CODE'] = request.LANGUAGE_CODE - else: - context_extras['LANGUAGE_CODE'] = settings.LANGUAGE_CODE - - from django.utils import translation + context_extras['LANGUAGE_CODE'] = translation.get_language() context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi() return context_extras