mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Fix crash when not language is set
This commit is contained in:
@@ -123,18 +123,19 @@ def get_babel_locale():
|
|||||||
# fallback to english
|
# fallback to english
|
||||||
|
|
||||||
try_locales = []
|
try_locales = []
|
||||||
if "-" in current_language:
|
if current_language:
|
||||||
lng_parts = current_language.split("-")
|
if "-" in current_language:
|
||||||
if current_region:
|
lng_parts = current_language.split("-")
|
||||||
try_locales.append(f"{lng_parts[0]}_{lng_parts[1].title()}_{current_region.upper()}")
|
if current_region:
|
||||||
try_locales.append(f"{lng_parts[0]}_{current_region.upper()}")
|
try_locales.append(f"{lng_parts[0]}_{lng_parts[1].title()}_{current_region.upper()}")
|
||||||
try_locales.append(f"{lng_parts[0]}_{lng_parts[1].upper()}")
|
try_locales.append(f"{lng_parts[0]}_{current_region.upper()}")
|
||||||
try_locales.append(f"{lng_parts[0]}_{lng_parts[1].title()}")
|
try_locales.append(f"{lng_parts[0]}_{lng_parts[1].upper()}")
|
||||||
try_locales.append(f"{lng_parts[0]}")
|
try_locales.append(f"{lng_parts[0]}_{lng_parts[1].title()}")
|
||||||
else:
|
try_locales.append(f"{lng_parts[0]}")
|
||||||
if current_region:
|
else:
|
||||||
try_locales.append(f"{current_language}_{current_region.upper()}")
|
if current_region:
|
||||||
try_locales.append(f"{current_language}")
|
try_locales.append(f"{current_language}_{current_region.upper()}")
|
||||||
|
try_locales.append(f"{current_language}")
|
||||||
|
|
||||||
try_locales.append(settings.LANGUAGE_CODE)
|
try_locales.append(settings.LANGUAGE_CODE)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user