From 059179aecb87ee275a3c61c7b75f928355457f80 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 23 Jan 2026 11:35:37 +0100 Subject: [PATCH] Fix babel locale discovery for zh_Hans_US --- src/pretix/base/i18n.py | 2 +- src/tests/helpers/test_i18n.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pretix/base/i18n.py b/src/pretix/base/i18n.py index 4aeb19a33b..25ebd8c01e 100644 --- a/src/pretix/base/i18n.py +++ b/src/pretix/base/i18n.py @@ -141,7 +141,7 @@ def get_babel_locale(): for locale in try_locales: if localedata.exists(locale): - return locale + return localedata.normalize_locale(locale) return "en" diff --git a/src/tests/helpers/test_i18n.py b/src/tests/helpers/test_i18n.py index 0726af70d6..823e8c7adb 100644 --- a/src/tests/helpers/test_i18n.py +++ b/src/tests/helpers/test_i18n.py @@ -59,6 +59,7 @@ def test_get_locale(): ("pt-pt", "PT", "pt-pt", "pt-pt", "pt_PT"), ("es", "MX", "es-mx", "es", "es_MX"), ("es-419", "MX", "es-419", "es-419", "es_MX"), + ("zh-hans", "US", "zh-hans", "zh-hans", "zh_Hans"), ("zh-hans", "CN", "zh-hans", "zh-hans", "zh_Hans_CN"), ("zh-hant", "TW", "zh-hant", "zh-hant", "zh_Hant_TW"), ],