Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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 malcolmt authored
Showing with 3 additions and 6 deletions.
  1. +3 −6 django/core/context_processors.py
9 django/core/context_processors.py
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.