Ticket #7720: fallback_to_first_part_of_language_code_of_cookie.diff

File fallback_to_first_part_of_language_code_of_cookie.diff, 674 bytes (added by Djoume Salvetti, 16 years ago)
  • django/utils/translation/trans_real.py

    old new  
    355355            return lang_code
    356356
    357357    lang_code = request.COOKIES.get(settings.LANGUAGE_COOKIE_NAME)
     358
     359    if lang_code and lang_code not in supported:
     360        lang_code = lang_code[:2] # if fr-ca is not supported fallback to fr
     361
    358362    if lang_code and lang_code in supported and check_for_language(lang_code):
    359363        return lang_code
    360364
Back to Top