The simple library for i18n support.
Project description
i21y
i21y (a.k.a internationalization.py) is library for support i18n in Python. It is easy to use.
Features:
- Zero dependencies by default
- Simple design
- Utilities to simplify keys
Installation
Normal: pip install i21y
YAML support: pip install i21y[yaml]
Fast JSON (by orjson) support: pip install i21y[fast-json]
Example
Basic
from i21y import Translator
from i21y.loaders.json import Loader
t = Translator(Loader("locale"))
assert t("main.responses.not_found", locale="ja") == "見つからなかった。"
Advanced
from i21y import locale_str
LONG_KEY = locale_str("very.long.locale.key.yeah_so_long")
print(LONG_KEY.but_easy_to_use) # very.long.locale.key.yeah_so_long.but_easy_to_use
assert t(LONG_KEY.but_easy_to_use, locale="ja") == "とても長いキーでも簡単に使える。"
assert t(LONG_KEY + "but_easy_to_use", locale="ja") == "とても長いキーでも簡単に使える。"
Documentation
See the documentation for usage and details.
Contributing Guide
This project is managed by the package manager PDM.
In coding, please use Black as a code formatter and pyright for type checking. The configuration is described in pyproject.toml
.
Please write what you have done in a complete sentence and use the original form of the verb. e.g. Fix that locale_str can't join
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file i21y-0.3.0.tar.gz
.
File metadata
- Download URL: i21y-0.3.0.tar.gz
- Upload date:
- Size: 35.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c03abdfaecded66af6f65fa3a6dd54839c1588130c254b0d4b55e266129c02a |
|
MD5 | c62d6197497669c7eaf398e021c6b282 |
|
BLAKE2b-256 | 712007ce2aed439050ff2abe557f319eb0b24fc40b63726e8c74aebfcb805172 |
File details
Details for the file i21y-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: i21y-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36d377c092f1b7ff11992a7e92b583edda53910599236d17870264ed37867c10 |
|
MD5 | 091e06449533fdd5ec729657a56b06d3 |
|
BLAKE2b-256 | ba5481b1c08f16868590e84c738e2421c696094cef727022386bfffe23c306ac |