From 86f47ee411f582aab204f3bb8af882d98ca4bfe8 Mon Sep 17 00:00:00 2001 From: snowykami Date: Fri, 29 Nov 2024 00:01:49 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=B3=BB=E7=BB=9F=E8=AF=AD=E8=A8=80=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?None=E5=80=BC=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/base/language.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/base/language.py b/src/utils/base/language.py index 37418534..455299b9 100644 --- a/src/utils/base/language.py +++ b/src/utils/base/language.py @@ -213,7 +213,11 @@ def get_system_lang_code() -> str: """ 获取系统语言代码 """ - return locale.getdefaultlocale()[0].replace("_", "-") + l = locale.getdefaultlocale() + if l[0] is None: + return "zh-CN" + else: + return l[0].replace("_", "-") def get_default_lang_code() -> str: