Ticket #7072: 7072_i18n_context_processor_fix.diff

File 7072_i18n_context_processor_fix.diff, 729 bytes (added by akaihola, 7 years ago)

patch for retrieving active language from get_language() instead of request.LANGUAGE_CODE in the i18n context processor

  • django/core/context_processors.py

     
    4040def i18n(request):
    4141    context_extras = {}
    4242    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
    4743
    4844    from django.utils import translation
     45    context_extras['LANGUAGE_CODE'] = translation.get_language()
    4946    context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi()
    5047
    5148    return context_extras
Back to Top