Ticket #5603: language_cookie_name.diff

File language_cookie_name.diff, 1.7 KB (added by moe, 8 years ago)

patch: add LANGUAGE_COOKIE_NAME

  • django/utils/translation/trans_real.py

     
    338338        if lang_code in supported and lang_code is not None and check_for_language(lang_code):
    339339            return lang_code
    340340
    341     lang_code = request.COOKIES.get('django_language', None)
     341    lang_code = request.COOKIES.get( settings.LANGUAGE_COOKIE_NAME, None)
    342342    if lang_code in supported and lang_code is not None and check_for_language(lang_code):
    343343        return lang_code
    344344
  • django/views/i18n.py

     
    2222        if hasattr(request, 'session'):
    2323            request.session['django_language'] = lang_code
    2424        else:
    25             response.set_cookie('django_language', lang_code)
     25            response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code)
    2626    return response
    2727
    2828NullSource = """
  • django/conf/global_settings.py

     
    9090# to load the internationalization machinery.
    9191USE_I18N = True
    9292
     93#
     94# Make sure that this is different to to all
     95# other cookie names (e.g. SESSION_COOKIE_NAME)
     96#
     97LANGUAGE_COOKIE_NAME = 'django_language'
     98
    9399# Not-necessarily-technical managers of the site. They get broken link
    94100# notifications and other various e-mails.
    95101MANAGERS = ADMINS
Back to Top