Skip to main content

Detect the system language.

Project description

> 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 ↑

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sys_lang-1.0.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sys_lang-1.0.1-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file sys_lang-1.0.1.tar.gz.

File metadata

  • Download URL: sys_lang-1.0.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for sys_lang-1.0.1.tar.gz
Algorithm Hash digest
SHA256 26d18c1a1f152b9da5ead8e6bf374e0e1959a253ea8b7adbad9c14b2b2b8a4b5
MD5 9b09d575ee42edfa023ac5ce57fe0cf4
BLAKE2b-256 c5ae6bbf6c155e972cf5e141072884609cc4fae364f1eddb660b3af8dd228151

See more details on using hashes here.

File details

Details for the file sys_lang-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: sys_lang-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for sys_lang-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 429794ff82f4a5edcdf71e6d1b5cba5806f8c9c8fddc42ca87a932881973dfb7
MD5 632cf54ad3f08190f6684ee1310c7b6a
BLAKE2b-256 99942c991a967a25f0433d8e789427677851e38abc665929800611ae4fc8f471

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page