Krywok Pipeline Plugin I18n is a plugin for Krywok Pipeline that provides i18n support.
Project description
Krywok Pipeline Plugin I18n is a plugin for Krywok Pipeline that provides internationalization (i18n) support.
Features
- Comprehensive translations for all standard
ConditionandMatchhandlers. - Simple initialization to register all translations globally.
Installation
pip install "krywok-pipeline[i18n]"
Quick Start
Initialize the plugin at the start of your application to register the translations.
You must call set_base_locale before running the first handler to ensure the system correctly maps the initial translation state.
from pipeline_plugin_i18n import initialize_pipeline_plugin_i18n
# Register translations for standard handlers
initialize_pipeline_plugin_i18n()
# Set the base locale
PipelinePluginI18n.set_base_locale("en")
Context Management
The plugin uses contextvars to manage the locale state, making it thread-safe and safe for asynchronous applications (e.g., FastAPI, Falcon, Flask).
Setting the Locale
You can set the locale for the current context (e.g., per request).
from pipeline_plugin_i18n import PipelinePluginI18n
# Set to Polish
PipelinePluginI18n.set_locale("pl")
Getting the Locale
from pipeline_plugin_i18n import PipelinePluginI18n
current_locale = PipelinePluginI18n.get_locale()
print(current_locale) # Output: "pl"
Custom Translations
You can register your own translations for any Condition or Match handler.
from pipeline.handlers import Match
from pipeline.handlers.base_handler.resources.constants import HandlerMode
from pipeline_plugin_i18n import PipelinePluginI18n
PipelinePluginI18n.register_handler(
handler=Match.Text.Letters,
translations={
HandlerMode.ROOT: {
"en": Match.Text.Letters.ERROR_TEMPLATES[HandlerMode.ROOT],
"pl": "Musi zawierać tylko litery (np. Aaaaa).",
}
},
)
Supported Languages
- English (
en) - Polish (
pl)
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 krywok_pipeline_plugin_i18n-1.0.0.tar.gz.
File metadata
- Download URL: krywok_pipeline_plugin_i18n-1.0.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9380f949577741eb70142022d2c72f84c87b01f45cbff1ed24304bf03424ff1
|
|
| MD5 |
ac698e5bf752b755fd5cc77168b7aaf9
|
|
| BLAKE2b-256 |
4b70762fab1ec1b27a5875a9f019f943abb7a3399f169690ca5b64d3afa0fbc7
|
Provenance
The following attestation bundles were made for krywok_pipeline_plugin_i18n-1.0.0.tar.gz:
Publisher:
python-publish.yml on Krywok/krywok-pipeline-plugin-i18n
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krywok_pipeline_plugin_i18n-1.0.0.tar.gz -
Subject digest:
c9380f949577741eb70142022d2c72f84c87b01f45cbff1ed24304bf03424ff1 - Sigstore transparency entry: 1163088587
- Sigstore integration time:
-
Permalink:
Krywok/krywok-pipeline-plugin-i18n@be2670bdeb572c15ecafe680e06ea97ebe04f3d4 -
Branch / Tag:
- Owner: https://github.com/Krywok
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@be2670bdeb572c15ecafe680e06ea97ebe04f3d4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file krywok_pipeline_plugin_i18n-1.0.0-py3-none-any.whl.
File metadata
- Download URL: krywok_pipeline_plugin_i18n-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1181d6df6b2b9ef96897e2ae4fdc2a659fd3e8029d93b45fc7e5d1f19c5b518d
|
|
| MD5 |
059d4e3c93381cf6f7b90672d1079101
|
|
| BLAKE2b-256 |
7431ec1cbb805ca77836b540e3285637235d5f084c47edc1019b9f74e0c8f46f
|
Provenance
The following attestation bundles were made for krywok_pipeline_plugin_i18n-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on Krywok/krywok-pipeline-plugin-i18n
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krywok_pipeline_plugin_i18n-1.0.0-py3-none-any.whl -
Subject digest:
1181d6df6b2b9ef96897e2ae4fdc2a659fd3e8029d93b45fc7e5d1f19c5b518d - Sigstore transparency entry: 1163088650
- Sigstore integration time:
-
Permalink:
Krywok/krywok-pipeline-plugin-i18n@be2670bdeb572c15ecafe680e06ea97ebe04f3d4 -
Branch / Tag:
- Owner: https://github.com/Krywok
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@be2670bdeb572c15ecafe680e06ea97ebe04f3d4 -
Trigger Event:
release
-
Statement type: