mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[4.1.x] Fixed #33888 -- Fixed get_select2_language() crash with no language activated.
Regression in3079133c73. Backport of0638b4e23dfrom main
This commit is contained in:
committed by
Mariusz Felisiak
parent
a3ce58ac4c
commit
2ae024c744
@@ -456,7 +456,7 @@ SELECT2_TRANSLATIONS.update({"zh-hans": "zh-CN", "zh-hant": "zh-TW"})
|
||||
def get_select2_language():
|
||||
lang_code = get_language()
|
||||
supported_code = SELECT2_TRANSLATIONS.get(lang_code)
|
||||
if supported_code is None:
|
||||
if supported_code is None and lang_code is not None:
|
||||
# If 'zh-hant-tw' is not supported, try subsequent language codes i.e.
|
||||
# 'zh-hant' and 'zh'.
|
||||
i = None
|
||||
|
||||
Reference in New Issue
Block a user