From 628e1947bb9cd8d478827a0d3894dd07f37860b9 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Wed, 19 Feb 2025 23:26:16 +0300 Subject: [PATCH] detect_locale.py: fix os.environ["LANG"] --- python-programming/detect_locale.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python-programming/detect_locale.py b/python-programming/detect_locale.py index fafa06f..c0834a3 100644 --- a/python-programming/detect_locale.py +++ b/python-programming/detect_locale.py @@ -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