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:
Malcolm Tredinnick 2008-07-06 05:25:55 +00:00
parent c71686489b
commit bff075973a
1 changed files with 3 additions and 6 deletions

View File

@ -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