Metadata-Version: 2.4
Name: sys-lang
Version: 1.0.0
Summary: Detect the system language.
Author-email: Adam Lui <adam@kudoai.com>
License-Expression: MIT
Project-URL: Changelog, https://github.com/adamlui/python-utils/releases/tag/sys-lang-1.0.0
Project-URL: Documentation, https://github.com/adamlui/python-utils/tree/main/sys-lang/docs
Project-URL: Funding, https://github.com/sponsors/adamlui
Project-URL: Homepage, https://github.com/adamlui/python-utils/tree/main/sys-lang/#readme
Project-URL: Issues, https://github.com/adamlui/python-utils/issues
Project-URL: PyPI Stats, https://pepy.tech/projects/sys-lang
Project-URL: Releases, https://github.com/adamlui/python-utils/releases
Project-URL: Repository, https://github.com/adamlui/python-utils
Keywords: api,cli,console,detect,detection,dev-tool,environment,language,locale,shell,system-language,system-locale,terminal,utility
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Localization
Classifier: Topic :: System
Classifier: Topic :: System :: Shells
Classifier: Topic :: Terminals
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: <4,>=3.8
Description-Content-Type: text/markdown
License-File: docs/LICENSE.md
Requires-Dist: colorama<1,>=0.4.6; platform_system == "Windows"
Requires-Dist: is_unicode_supported<2,>=1.1.2
Requires-Dist: json5<1,>=0.13.0
Requires-Dist: non-latin-locales<2,>=1.0.1
Provides-Extra: dev
Requires-Dist: nox>=2026.2.9; extra == "dev"
Requires-Dist: remove-json-keys<2,>=1.9.2; extra == "dev"
Requires-Dist: tomli<3,>=2.4.0; extra == "dev"
Requires-Dist: tomli-w<2,>=1.2.0; extra == "dev"
Requires-Dist: translate-messages<2,>=1.9.1; extra == "dev"
Dynamic: license-file

<a id="top"></a>

# > sys-lang

<a href="https://github.com/adamlui/python-utils/releases/tag/sys-lang-1.0.0">
    <img height=31 src="https://img.shields.io/badge/Latest_Build-1.0.0-32fcee.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
<a href="https://github.com/adamlui/python-utils/blob/main/sys-lang/docs/LICENSE.md">
    <img height=31 src="https://img.shields.io/badge/License-MIT-f99b27.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
<a href="https://www.codefactor.io/repository/github/adamlui/python-utils">
    <img height=31 src="https://img.shields.io/codefactor/grade/github/adamlui/python-utils?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=a0fc55&style=for-the-badge"></a>
<a href="https://sonarcloud.io/component_measures?metric=vulnerabilities&selected=adamlui_python-utils%3Asys-lang&id=adamlui_python-utils">
    <img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_python-utils%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonar&logoColor=white&labelColor=464646&label=Vulnerabilities&color=fafc74"></a>

> ### _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

```bash
pip install sys-lang
```

## 💻 Command line usage

```bash
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

```py
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](https://github.com/adamlui)

## Related

🇪🇸 [latin-locales](https://github.com/adamlui/python-utils/tree/main/latin-locales/#readme) - ISO 639-1 (2-letter) codes for Latin locales.
<br>🇨🇳 [non-latin-locales](https://github.com/adamlui/python-utils/tree/main/non-latin-locales/#readme) - ISO 639-1 (2-letter) codes for non-Latin locales.
<br>🌍 [translate-messages](https://github.com/adamlui/python-utils/tree/main/translate-messages/#readme) - Translate `en/messages.json` (chrome.i18n format) to 100+ locales automatically.
<br>🈶 [is-unicode-supported](https://github.com/adamlui/python-utils/tree/main/is-unicode-supported/#readme) - Detect whether the terminal supports advanced Unicode.

#

<picture><source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/adamlui/python-utils@760599e/assets/images/icons/home/white/icon32x27.png"><img height=13 src="https://cdn.jsdelivr.net/gh/adamlui/python-utils@760599e/assets/images/icons/home/dark-gray/icon32x27.png"></picture> <a href=https://github.com/adamlui/python-utils/#readme>**More Python utilities**</a> /
<a href="#top">Back to top ↑</a>
