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:
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from os import name as os_name
|
from os import environ, name as os_name
|
||||||
if os_name == "nt":
|
if os_name == "nt":
|
||||||
from ctypes import windll
|
from ctypes import windll
|
||||||
from locale import windows_locale
|
from locale import windows_locale
|
||||||
@@ -16,7 +16,7 @@ if os_name == "nt":
|
|||||||
|
|
||||||
def detect_locale() -> Optional[str]:
|
def detect_locale() -> Optional[str]:
|
||||||
if os_name == "posix":
|
if os_name == "posix":
|
||||||
return os.environ["LANG"]
|
return environ["LANG"]
|
||||||
if os_name == "nt":
|
if os_name == "nt":
|
||||||
return windows_locale[windll.kernel32.GetUserDefaultUILanguage()]
|
return windows_locale[windll.kernel32.GetUserDefaultUILanguage()]
|
||||||
return None
|
return None
|
||||||
|
Reference in New Issue
Block a user