Skip to main content

A Python implementation of i18next.

Project description

bitstillery_pyi18next

This is a fork of pyi18next, that fixes pluralisation count.

Documentation Status

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


Download files

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

Source Distribution

bitstillery_pyi18next-0.0.7.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

bitstillery_pyi18next-0.0.7-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file bitstillery_pyi18next-0.0.7.tar.gz.

File metadata

File hashes

Hashes for bitstillery_pyi18next-0.0.7.tar.gz
Algorithm Hash digest
SHA256 7986cf81e695933c74dce20004d68a3855cc3c3f66dacbe32f92478e17da38d3
MD5 4e66a2c6188316950e7cec37ecc78eb1
BLAKE2b-256 aec3800abbfa7683669ab54a713df7811854bd24a92f793c05e902b400b9f0e1

See more details on using hashes here.

File details

Details for the file bitstillery_pyi18next-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for bitstillery_pyi18next-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a0400db693bdb93f6ec5d72ad00cddc9b3c2b97a06a1cf04e9098412c7a18314
MD5 321c5c03e25a143b177cf87d9169bc3b
BLAKE2b-256 80d9b70f0e8fb6be4986fabaf7bb94e1a70a197c8c949f8811d912dc0320fcde

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