Skip to main content

High-performance i18n for FastAPI with Rust-powered translation engine

Project description

i18n-fastapi

PyPI version Python versions License CI

High-performance internationalization for FastAPI, powered by a Rust translation engine with automatic Python fallback.

Features

  • Rust-powered engine — blazing-fast translation lookups via PyO3, with pure Python fallback
  • ICU plural support — zero / one / two / few / many / other
  • Configurable locale detection — query params, cookies, headers, path prefix, in any priority order
  • Plugin pattern — one-line setup with I18n(app)
  • Multiple locale directories — shared + per-module translations with filename-based namespacing
  • Duplicate key detection — catch conflicts at startup, not at runtime
  • Hot reload — watch translation files during development
  • Built-in endpointGET /i18n/languages returns available locales
  • FastAPI dependencies — inject Locale and TranslateFunc into route handlers

Installation

pip install i18n-fastapi

For hot reload during development:

pip install "i18n-fastapi[reload]"

Quick Start

Create translation files:

locales/
├── en/
│   └── messages.json    # {"greeting": "Hello {name}"}
└── es/
    └── messages.json    # {"greeting": "Hola {name}"}

Set up your app:

from fastapi import FastAPI
from i18n_fastapi import I18n, t

app = FastAPI()
I18n(app)

@app.get("/greet")
async def greet():
    return {"message": t("messages.greeting", name="World")}

Request with ?lang=es or Accept-Language: es and the response adapts automatically.

Documentation

Author

Johnatan Palacios Londoño — johnatan.palacios@utp.edu.co

License

MIT

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

i18n_fastapi-0.1.3.tar.gz (17.2 kB view details)

Uploaded Source

Built Distributions

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

i18n_fastapi-0.1.3-cp313-cp313-win_amd64.whl (224.2 kB view details)

Uploaded CPython 3.13Windows x86-64

i18n_fastapi-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (366.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

i18n_fastapi-0.1.3-cp313-cp313-macosx_11_0_arm64.whl (318.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

i18n_fastapi-0.1.3-cp312-cp312-win_amd64.whl (224.7 kB view details)

Uploaded CPython 3.12Windows x86-64

i18n_fastapi-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (367.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

i18n_fastapi-0.1.3-cp312-cp312-macosx_11_0_arm64.whl (318.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

i18n_fastapi-0.1.3-cp311-cp311-win_amd64.whl (224.2 kB view details)

Uploaded CPython 3.11Windows x86-64

i18n_fastapi-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (367.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

i18n_fastapi-0.1.3-cp311-cp311-macosx_11_0_arm64.whl (321.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file i18n_fastapi-0.1.3.tar.gz.

File metadata

  • Download URL: i18n_fastapi-0.1.3.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for i18n_fastapi-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f31224f4be1450b904136e547a9a95843098d2e249708bdc0e3ad828e3c8d295
MD5 544f86de72f5e722c877c314094d1f04
BLAKE2b-256 8132e58d7dbdcc12a4da4cabc34469b777af6b9b23b5e31356ab369d675e8781

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3.tar.gz:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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

File details

Details for the file i18n_fastapi-0.1.3-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0ad33532c777a6a93f3070a47b6f13046d48b7f7c2908451adb2394fe065f34c
MD5 c5eec4da933f1775e36bf7802c6873c6
BLAKE2b-256 1f362fd43f459e8173908c6fa0d3cdfbf840cd5be1f734d833cf739eccbd86a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3-cp313-cp313-win_amd64.whl:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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

File details

Details for the file i18n_fastapi-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 54106365720557f321e7e47739083c51cf18be74f224b7f088b871380c4a2803
MD5 08e4d4c8c38967ed1416436a57fbaaec
BLAKE2b-256 cf9a3572820bd667a61618a4de782faf4a86ab2c06e8246669d4375c6425d360

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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

File details

Details for the file i18n_fastapi-0.1.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0861390956a408d2db87773d38974e977ee213f8484acf4d46ff3bb5c62202cb
MD5 23724ba34f892ce9e13840e7d4b5c5bc
BLAKE2b-256 91cf4d3053559867e4259e0887d30af4d082a4d6fdccdaf431631f5feae211da

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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

File details

Details for the file i18n_fastapi-0.1.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 47fa4843ef2d973f2b33b6aded312c59747de7b55734d35a6873f2ea8c8418a0
MD5 78f4e3afa0f94da065cdea86eee832a6
BLAKE2b-256 90017103445d313bcaf43f6c614c61f2fc3f98a51fa70a6f7157a7814f893af4

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3-cp312-cp312-win_amd64.whl:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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

File details

Details for the file i18n_fastapi-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 15a02985788193381a450411dab4b88173594a851fc63de3b0fd52eb8ee3cb1b
MD5 c6036df7ff3b2b36fa46777d72efd00e
BLAKE2b-256 13e365adeca25a7360d32a4cd2152ec14559af27791604145116f0bcf1587f81

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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

File details

Details for the file i18n_fastapi-0.1.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23a327fe38f6f75c411480aea3cfdcb575397f535d387d7bb9560ecb47063796
MD5 8242e60fc945c4c7401725325f451358
BLAKE2b-256 deaa4a4eaa167e1aa8e2a89250f460176dc22b5ec632f54a5b245da3c98cfae0

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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

File details

Details for the file i18n_fastapi-0.1.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1b332d196ed0ad295f4f676c3fc851c7d92278c997d89477309fe927f3a3637a
MD5 c6c60d56258b1f5ea065a49b0d63ffae
BLAKE2b-256 2c4e6eaa3af7e8ba6941339680424826915036a01305933d82c93db3d031146a

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3-cp311-cp311-win_amd64.whl:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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

File details

Details for the file i18n_fastapi-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 16b71f4bf91a2be718ba81efc2e882f473e1847d781cc7ecee4721575e302457
MD5 984b0ff84117fa5b687559e1231e1068
BLAKE2b-256 7f9ce6575a7daed986f67929483695207f85c2338f5f79d2f40e913491b2e0e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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

File details

Details for the file i18n_fastapi-0.1.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0ba068f0c6138b868210ec285d7e5480f60c1ec54f230cd98d8198d442772d8
MD5 0845027e2ba576f788c75b73dfa2f3bd
BLAKE2b-256 fa67e4e5aa60cec5b6bfee7de6b96b2c94aa17a78b1f16afee3ead9e1e2e8ca1

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.3-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on JohnatanPalacios/i18n-fastapi

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