Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit bff075973a84387f2f25c223a7d9fa8ce09d104a 1 parent c716864
Malcolm Tredinnick authored July 06, 2008

Showing 1 changed file with 3 additions and 6 deletions. Show diff stats Hide diff stats

  1. 9  django/core/context_processors.py
9  django/core/context_processors.py
@@ -38,14 +38,11 @@ def debug(request):
38 38
     return context_extras
39 39
 
40 40
 def i18n(request):
  41
+    from django.utils import translation
  42
+
41 43
     context_extras = {}
42 44
     context_extras['LANGUAGES'] = settings.LANGUAGES
43  
-    if hasattr(request, 'LANGUAGE_CODE'):
44  
-        context_extras['LANGUAGE_CODE'] = request.LANGUAGE_CODE
45  
-    else:
46  
-        context_extras['LANGUAGE_CODE'] = settings.LANGUAGE_CODE
47  
-
48  
-    from django.utils import translation
  45
+    context_extras['LANGUAGE_CODE'] = translation.get_language()
49 46
     context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi()
50 47
 
51 48
     return context_extras

0 notes on commit bff0759

Please sign in to comment.
Something went wrong with that request. Please try again.