Skip to main content

Hetman Pipeline Plugin I18n is a plugin for Hetman Pipeline that provides i18n support.

Project description

Hetman Logo

Hetman Pipeline Plugin I18n is a plugin for Hetman Pipeline that provides internationalization (i18n) support.

Features

  • Comprehensive translations for all standard Condition and Match handlers.
  • Simple initialization to register all translations globally.

Installation

pip install hetman-pipeline[i18n]

Quick Start

Initialize the plugin at the start of your application to register the translations.

from pipeline_plugin_i18n import initialize_pipeline_plugin_i18n

# Register translations for standard handlers
initialize_pipeline_plugin_i18n()

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) - Default
  • Polish (pl)

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

hetman_pipeline_plugin_i18n-1.0.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

hetman_pipeline_plugin_i18n-1.0.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file hetman_pipeline_plugin_i18n-1.0.1.tar.gz.

File metadata

File hashes

Hashes for hetman_pipeline_plugin_i18n-1.0.1.tar.gz
Algorithm Hash digest
SHA256 11b162bec45c2e7954e1a43f777da4b2f5ebabbaaee70ca80a6d43c6ec960cb9
MD5 a7761949e6c767d1711196ef8dba7bbd
BLAKE2b-256 930e97c3a1c4ff2ecc311417b50a3d5fc23e477b621114d5e6e3f12fb2fcee37

See more details on using hashes here.

Provenance

The following attestation bundles were made for hetman_pipeline_plugin_i18n-1.0.1.tar.gz:

Publisher: python-publish.yml on hetman-app/hetman-pipeline-plugin-i18n

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hetman_pipeline_plugin_i18n-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hetman_pipeline_plugin_i18n-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb1b98982cfb8de2f1837fd47a091112d79407f9b5777dcd5712d4375f4f3055
MD5 5aebeb5330f2c23fb797b6c13eb19fba
BLAKE2b-256 f0c61cd26599727778543031a6836550964744e60d6fb60f0441f90c31abe05c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hetman_pipeline_plugin_i18n-1.0.1-py3-none-any.whl:

Publisher: python-publish.yml on hetman-app/hetman-pipeline-plugin-i18n

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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