High-performance i18n for FastAPI with Rust-powered translation engine
Project description
i18n-fastapi
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 endpoint —
GET /i18n/languagesreturns available locales - FastAPI dependencies — inject
LocaleandTranslateFuncinto 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
- Usage Guide — configuration, locale detection, pluralization, and more
- Contributing — how to set up the dev environment, run tests, and submit PRs
- Publishing — how to publish releases to PyPI
- Changelog — version history
- Code of Conduct — community standards
Author
Johnatan Palacios Londoño — johnatan.palacios@utp.edu.co
License
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 Distributions
Built Distributions
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 i18n_fastapi-0.1.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: i18n_fastapi-0.1.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 224.2 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b709c4d43945390d0e66ed155214f5ce5fe7886c78e0435b90eb6b1c00112b07
|
|
| MD5 |
05e5ed17eb1d52a6c23422f11f3a0572
|
|
| BLAKE2b-256 |
f762b0ee311622c2b53a606e39ebaf036f04d417ff6f659be60a780d0c2eed36
|
Provenance
The following attestation bundles were made for i18n_fastapi-0.1.0-cp311-cp311-win_amd64.whl:
Publisher:
release.yml on JohnatanPalacios/i18n-fastapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
i18n_fastapi-0.1.0-cp311-cp311-win_amd64.whl -
Subject digest:
b709c4d43945390d0e66ed155214f5ce5fe7886c78e0435b90eb6b1c00112b07 - Sigstore transparency entry: 1154902062
- Sigstore integration time:
-
Permalink:
JohnatanPalacios/i18n-fastapi@15785e8dfda331e454ed592184adaaa2ce81dde3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/JohnatanPalacios
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@15785e8dfda331e454ed592184adaaa2ce81dde3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file i18n_fastapi-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: i18n_fastapi-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 321.4 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71a59cc56f86a7b89ab670bc62adc306df1e6497d1e105ea7a8dbd7b7c3cfa8a
|
|
| MD5 |
89e4c0ba39eb8c195e3ccde909f056ef
|
|
| BLAKE2b-256 |
3f8e3044b49f5aa6e89ba8d86030d45ab19afaee0c636efdfe50955e946474bf
|
Provenance
The following attestation bundles were made for i18n_fastapi-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
release.yml on JohnatanPalacios/i18n-fastapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
i18n_fastapi-0.1.0-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
71a59cc56f86a7b89ab670bc62adc306df1e6497d1e105ea7a8dbd7b7c3cfa8a - Sigstore transparency entry: 1154902056
- Sigstore integration time:
-
Permalink:
JohnatanPalacios/i18n-fastapi@15785e8dfda331e454ed592184adaaa2ce81dde3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/JohnatanPalacios
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@15785e8dfda331e454ed592184adaaa2ce81dde3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file i18n_fastapi-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: i18n_fastapi-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 367.7 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37b8923d177baea793556121e6745532076b66e1e863370a6820e6ca6d4e03d0
|
|
| MD5 |
97bf9c6de185992bd68a7edcef308c19
|
|
| BLAKE2b-256 |
81145538696a39e0eabea18c5149b259ec8203e2caa9c3ea916950332a1f663a
|
Provenance
The following attestation bundles were made for i18n_fastapi-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on JohnatanPalacios/i18n-fastapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
i18n_fastapi-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
37b8923d177baea793556121e6745532076b66e1e863370a6820e6ca6d4e03d0 - Sigstore transparency entry: 1154902059
- Sigstore integration time:
-
Permalink:
JohnatanPalacios/i18n-fastapi@15785e8dfda331e454ed592184adaaa2ce81dde3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/JohnatanPalacios
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@15785e8dfda331e454ed592184adaaa2ce81dde3 -
Trigger Event:
push
-
Statement type: