A Python implementation of i18next.
Project description
bitstillery_pyi18next
This is a fork of pyi18next, that fixes pluralisation count.
A Python implementation of i18next. Documentation is available at pyi18next.readthedocs.io.
Quick Start
Install
python -m pip install -U bitstillery_pyi18next
Init
We can define a I18next object with translations loaded as follow:
import bitstillery_pyi18next as pyi18next
i18n = pyi18next.i18next.I18next(
resources={
'en': {
'translation': {
'key': 'value',
'interpolation': 'Hello, {{name}}!',
'nested': '$t(key)',
}
}
},
default_lng='en',
default_ns='translation'
)
Translate
We can use the i18n object we defined to translate:
print(f'{i18n.t("key")=}')
print(f'{i18n.t("interpolation", name="world")=}')
print(f'{i18n.t("nested")=}')
The results are:
i18n.t("key")='value'
i18n.t("interpolation", name="world")='Hello, world!'
i18n.t("nested")='value'
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bitstillery_pyi18next-0.0.7.tar.gz.
File metadata
- Download URL: bitstillery_pyi18next-0.0.7.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7986cf81e695933c74dce20004d68a3855cc3c3f66dacbe32f92478e17da38d3
|
|
| MD5 |
4e66a2c6188316950e7cec37ecc78eb1
|
|
| BLAKE2b-256 |
aec3800abbfa7683669ab54a713df7811854bd24a92f793c05e902b400b9f0e1
|
File details
Details for the file bitstillery_pyi18next-0.0.7-py3-none-any.whl.
File metadata
- Download URL: bitstillery_pyi18next-0.0.7-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0400db693bdb93f6ec5d72ad00cddc9b3c2b97a06a1cf04e9098412c7a18314
|
|
| MD5 |
321c5c03e25a143b177cf87d9169bc3b
|
|
| BLAKE2b-256 |
80d9b70f0e8fb6be4986fabaf7bb94e1a70a197c8c949f8811d912dc0320fcde
|