diff --git a/django/core/context_processors.py b/django/core/context_processors.py index 55c19c17e8..bde3f665d4 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