Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

> sys-lang

Detect the system language.

Returns ISO 639-1 (e.g. 'en') or ISO 3166-1 alpha-2-appended ('en_US') code for user's preferred language. On Windows, queries Get-Culture via PowerShell. On *nix systems, reads LC_ALL, LC_MESSAGES, LANG, and LANGUAGE.

⚡ Installation

pip install sys-lang

💻 Command line usage

sys-lang  # or syslang
# e.g. => 'en_US'

CLI options:

Option Description
-n, --no-region Don't include region when available
-h, --help Show help screen
-v, --version Show version
--docs Open docs URL

🔌 API usage

from sys_lang import get_sys_lang

print(get_sys_lang()) # e.g. => zh_HK
print(get_sys_lang(region=False)) # e.g. => zh

MIT License

Copyright © 2026 Adam Lui


Related

🇪🇸 latin-locales - ISO 639-1 (2-letter) codes for Latin locales.
🇨🇳 non-latin-locales - ISO 639-1 (2-letter) codes for non-Latin locales.
🌍 translate-messages - Translate en/messages.json (chrome.i18n format) to 100+ locales automatically.
🈶 is-unicode-supported - Detect whether the terminal supports advanced Unicode.

More Python utilities / Discuss / Report bug / Report vulnerability / Back to top ↑