mirror of https://github.com/django/django.git
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
This commit is contained in:
parent
c71686489b
commit
bff075973a
|
@ -38,14 +38,11 @@ def debug(request):
|
||||||
return context_extras
|
return context_extras
|
||||||
|
|
||||||
def i18n(request):
|
def i18n(request):
|
||||||
|
from django.utils import translation
|
||||||
|
|
||||||
context_extras = {}
|
context_extras = {}
|
||||||
context_extras['LANGUAGES'] = settings.LANGUAGES
|
context_extras['LANGUAGES'] = settings.LANGUAGES
|
||||||
if hasattr(request, 'LANGUAGE_CODE'):
|
context_extras['LANGUAGE_CODE'] = translation.get_language()
|
||||||
context_extras['LANGUAGE_CODE'] = request.LANGUAGE_CODE
|
|
||||||
else:
|
|
||||||
context_extras['LANGUAGE_CODE'] = settings.LANGUAGE_CODE
|
|
||||||
|
|
||||||
from django.utils import translation
|
|
||||||
context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi()
|
context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi()
|
||||||
|
|
||||||
return context_extras
|
return context_extras
|
||||||
|
|
Loading…
Reference in New Issue