Skip to main content

The simple library for i18n support.

Project description

PyPI PyPI - Python Version PyPI - License Documentation Status

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.

License

This project is licensed under the MIT License.

Contributing Guide

This project is managed by the package manager uv.
In coding, please use Ruff 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


Download files

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

Source Distribution

i21y-0.4.1.tar.gz (42.8 kB view details)

Uploaded Source

Built Distribution

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

i21y-0.4.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file i21y-0.4.1.tar.gz.

File metadata

  • Download URL: i21y-0.4.1.tar.gz
  • Upload date:
  • Size: 42.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for i21y-0.4.1.tar.gz
Algorithm Hash digest
SHA256 cf13d58e132dac56d1e54d1f934a1644cbddd2dc654efd0b6117007f0a22af36
MD5 5e088c307e36b808a6a945fa032c7930
BLAKE2b-256 1471f220c1c9b0713e8a41ffdf7c2aa5b954b553ed466994f40674e342a873c8

See more details on using hashes here.

File details

Details for the file i21y-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: i21y-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for i21y-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9bba573f256b557cf55659512e0cbb0aa0a39c9556aa2b2e4733b02e8aa45b15
MD5 7886703dc6411a2d3ed9b8f3d9e758cd
BLAKE2b-256 bdda64baf050d667c5b259501aab70fd88f47540a3eac2be8bfd8908c4e651e8

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