1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2025-05-31 08:31:41 +05:30

detect_locale.py: fix os.environ["LANG"]

This commit is contained in:
2025-02-19 23:26:16 +03:00
parent ba627444b2
commit 628e1947bb

View File

@@ -8,7 +8,7 @@
from typing import Optional
from os import name as os_name
from os import environ, name as os_name
if os_name == "nt":
from ctypes import windll
from locale import windows_locale
@@ -16,7 +16,7 @@ if os_name == "nt":
def detect_locale() -> Optional[str]:
if os_name == "posix":
return os.environ["LANG"]
return environ["LANG"]
if os_name == "nt":
return windows_locale[windll.kernel32.GetUserDefaultUILanguage()]
return None