py_intl
Python bindings for FormatJS's high-level Rust internationalization runtime.
python -m pip install py_intl
from datetime import date
from intl import Intl, IntlError, define_message
errors: list[IntlError] = []
intl = Intl(
["fr-CA", "fr"],
"en",
{"fr": {"hello": "Bonjour"}, "en": {}},
on_error=errors.append,
)
assert intl.format_message("hello", default_message="Hello") == "Bonjour"
# IDs are optional and generated from the descriptor.
assert intl.format_message(default_message="Welcome") == "Welcome"
greeting = define_message(default_message="Hello, {name}!")
assert intl.format_message(greeting, values={"name": "Ada"}) == "Hello, Ada!"
created = define_message(default_message="Created {value, date, medium}")
assert intl.format_message(created, values={"value": date(2024, 1, 2)}) == "Created Jan 2, 2024"
Use the Intl instance negotiated for the current request. Generated IDs are
locale-independent. on_error receives recovered missing-translation and
formatting errors while format_message continues through FormatJS fallback.
Datetime fields are formatted as supplied; convert timezone-aware values before
formatting when another presentation timezone is required.
Generated message contracts
Generate typed Python wrappers from a FormatJS source catalog:
{
"cart.total": {"defaultMessage": "{count, plural, other {# items}}"},
"cart.empty": {"defaultMessage": "Your cart is empty"}
}
python -m intl.codegen en.json --out messages.py
Keep both generated files: messages.py supplies runtime wrappers;
messages.pyi supplies message-specific TypedDict contracts. The stub uses
typing_extensions.ReadOnly for Python 3.12 compatibility. The wrappers add
no runtime dependency on typing_extensions.
from messages import cart_total, cart_empty
cart_total(intl, values={"count": 2})
cart_empty(intl)
# Type errors:
cart_total(intl)
cart_total(intl, values={"count": "two"})
Names derive from catalog IDs by replacing punctuation with underscores;
leading digits and Python keywords receive a message_ prefix. Collisions
are rejected. String catalogs and descriptors with defaultMessage and an
optional string description are supported.
Contracts come from the Rust ICU parser, including apostrophe escapes and every
nested branch. Numbers/plurals require int | float; dates/times accept
date | datetime | int | float. Repeated arguments must satisfy every role.
All contract fields are required and readonly to the type checker. Empty messages
allow omitted values. Runtime dictionaries are not frozen.
Python's type system treats bool as an int, so static numeric checks cannot
exclude booleans. Runtime formatting still checks values and translated messages.
Rich tags are rejected during generation because Python Intl has no rich callback
API. Raw Intl.format_message calls keep their existing dynamic interface;
use the generated wrappers for per-message checks. Generate from source catalogs,
not independently from each translation.
Metadata
Release files for py-intl 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| py_intl-0.3.0-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details for py_intl-0.3.0-cp312-abi3-manylinux_2_28_x86_64.whl |
| py_intl-0.3.0-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details for py_intl-0.3.0-cp312-abi3-manylinux_2_28_aarch64.whl |
| py_intl-0.3.0-cp312-abi3-macosx_11_0_x86_64.whl | CPython 3.12 | abi3 | macOS 11.0+ x86-64 | Details for py_intl-0.3.0-cp312-abi3-macosx_11_0_x86_64.whl |
| py_intl-0.3.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for py_intl-0.3.0-cp312-abi3-macosx_11_0_arm64.whl |
Total release size: 5.7 MB
Release files / py_intl-0.3.0-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | py_intl-0.3.0-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ded7562c310eaaaefc067ca227c26015bf5b17d4f92ac69b82c9f197603489ad
|
|
BLAKE2b-256 checksum How to use checksums |
7c02f31401c027ea76761475036150a46a0843c0cb2c531cc069993c148936d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / py_intl-0.3.0-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | py_intl-0.3.0-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3dba1d79af6fac5ef08c4eee78352fc3f8b58738a215de3274ad3ff8c0bb76e3
|
|
BLAKE2b-256 checksum How to use checksums |
db42af9a2657ac82fd1196bbd02584e798619f52b34cedd1048e9bf271082c95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / py_intl-0.3.0-cp312-abi3-macosx_11_0_x86_64.whl
| Download URL | py_intl-0.3.0-cp312-abi3-macosx_11_0_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
4726fc069eabd255cb42fec05ee6869b9ff6715c7d80333c3cedc883757661fa
|
|
BLAKE2b-256 checksum How to use checksums |
a4da172c1981388cd41ba01747f0e3bd0dfe99a675a46430df43eabbb69ec9b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / py_intl-0.3.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | py_intl-0.3.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6428e83b29d9a1043c0671122bd4657c32c6315e7245d793659544e98832d2ef
|
|
BLAKE2b-256 checksum How to use checksums |
44c9a152df52cad72795770b3cc6004567f00d4af3c589051298cac98be0dc31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logSecurity for py-intl 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for py_intl-0.3.0-cp312-abi3-manylinux_2_28_x86_64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.