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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

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

Uploaded CPython 3.13Windows x86-64

i18n_fastapi-0.1.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (318.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

i18n_fastapi-0.1.2-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.2-cp312-cp312-macosx_11_0_arm64.whl (318.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

i18n_fastapi-0.1.2-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.2-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.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7d3e482bc0de1b0d16a05a6e0b887651701f3bb35c214450df1131eee6f401ef
MD5 effc37052cfa0526a6c1b6b38c457902
BLAKE2b-256 a899fb2eb5ea4ee1e36859533cea4af8816ea9acdd3e0e3a4cca17f4c552076c

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.2-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.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c1e981317c3c28ee1294bcb36d4bc98bf41febdf128c4dae7edb4fcf82441bb
MD5 a655d7b922ef47387accb7a6bcfbd005
BLAKE2b-256 da342fc8b5be72f24aa19c6f631ed05ae36c62c0226b7be07515a1c2a45d374e

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.2-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.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f433bfc9b99138792173ef7354e8df417a20acf319cde70dfb341410fa68e07f
MD5 3f91f34714c7036f1bb275555e7b1a28
BLAKE2b-256 70a3c8a4fe5bbee7ffe78260bec7c54db5d896fa31ab11b7190efb627ed3610b

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.2-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.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bce93134bcd777c9a66a7e6f09a3aef520b4360765ded2babb551c8d333934c2
MD5 96386bf84d1f697a0203abe6586a312c
BLAKE2b-256 7c4a3b7bc00e8fd83a4c054faad0305141f4744800a6feabf42a7b2bd21b3341

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.2-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.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07e3bec543af1a8def531a54c60a2026223230a78295b4d4faae6b7632d58709
MD5 22a29f8cc928d527ffb58288211230b4
BLAKE2b-256 06bb04743adde4524ec5af8df653c1a851419178b928b6af1773a71dccba3fab

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.2-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.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2f279c6249d370c73f77cf6c3367e81cc1b43c648c97d03ec306b9e4cf6c51e2
MD5 d881ad19ce3a1a175c96a27f72fafb84
BLAKE2b-256 212f95623ca775ecc6877deea7362e0b19f41ff104069ff924c5f095fe8d4e89

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.2-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.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c0faf49d42ce6405d04467045d0b6df573575faad5b633d0dc4ccca692fad240
MD5 6a96f6d42c5eb80afc8a5b181aa83692
BLAKE2b-256 4d8e4e615b3c37ee630b3f23028fe7fb9d3a976e77aba00e9a4e3fa251854e92

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.2-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.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 27c5d86f80af05315345b0d61b979b519259127869faf85f4ecd9e8ef73b2203
MD5 ffcc4794ee3fe450877ac8b95ec4c1e9
BLAKE2b-256 ef6ee94bebd40a812bb23d44de6a0e506d85d5c0b70af65fde8419f37d049813

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.2-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.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for i18n_fastapi-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e429a87c483ada195f9d0a17308aae87d99a8e637ff92d6449b6e37a1ea4a58e
MD5 8014a621f02a89bdd94e6bda0a22bce2
BLAKE2b-256 3b03065caf3eb211222ece221ce4501d53379e25b8c7df8c04e0543e1e12c7fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for i18n_fastapi-0.1.2-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