Python runtime for the Fluent (FTL) specification: bidirectional parsing, CLDR-backed locale-aware formatting, and fail-fast boot validation with structured audit evidence.
Project description
FTLLexEngine — Fluent localization runtime and parser for Python
FTLLexEngine is a Python library for the Fluent .ftl specification: format locale-aware prices,
dates, and messages for 200+ locales, then parse localized user input back to exact Python types
in the same stack.
Most setups handle the two directions separately — one library brews the outbound message,
something hand-rolled to parse the reply back. Locale rules drift between them. FTLLexEngine runs
both from the same locale, validates .ftl resources at boot before the first request, and keeps
threads isolated without touching global state.
- Format currency, dates, and plural messages correctly for 200+ locales via CLDR
- Parse localized user input back to
Decimal,date, or typed values — no float drift - Validate
.ftlresources and message schemas at boot, before the first request - Thread-safe bundles, no global locale state
Copy-paste patterns · Workflow tour · PyPI
Both Ends of the Counter
A specialty coffee exporter invoices buyers in German. Buyers reply in their local number format. One runtime handles both ends:
from decimal import Decimal
from ftllexengine import FluentBundle
from ftllexengine.parsing import parse_currency
bundle = FluentBundle("de_DE", use_isolating=False)
bundle.add_resource('quote = Angebot: { CURRENCY($amount, currency: "EUR") }')
text, _ = bundle.format_pattern("quote", {"amount": Decimal("12450.00")})
# → "Angebot: 12.450,00 €" (non-breaking space before €)
parsed, _ = parse_currency("12.450,00 EUR", "de_DE", default_currency="EUR")
# → (Decimal("12450.00"), "EUR")
Same locale rules write the invoice and read the buyer's reply. No separate parser. No float approximation.
Where It Fits
Python apps using Fluent .ftl for messages, plural rules, and locale-aware formatting —
especially when users send localized prices, dates, or quantities that need to come back as exact
typed values. Systems that validate .ftl resources before accepting traffic, and concurrent apps
that need locale isolation without shared mutable state.
Install
Full runtime — formatting, bidirectional parsing, CLDR locale data:
uv add ftllexengine[babel]
# or: pip install "ftllexengine[babel]"
Parser only — FTL syntax, AST, validation, zero Babel dependency:
uv add ftllexengine
# or: pip install ftllexengine
Python 3.13+. Fully typed. Built on the Fluent specification with CLDR data via Babel.
Maintainers: Release protocol.
Legal
MIT-licensed. The optional [babel] extra adds Babel under BSD-3-Clause. FTLLexEngine is an
independent implementation of the Fluent syntax specification
and is not affiliated with or endorsed by Mozilla.
LICENSE · NOTICE · PATENTS.md
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 Distribution
Built Distribution
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 ftllexengine-0.166.0.tar.gz.
File metadata
- Download URL: ftllexengine-0.166.0.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44698a5806f7edb5d06fa5c9cad91f1d678b8e70243a3a2413dfb586c6986ed4
|
|
| MD5 |
af5b261e86f0bfe33afab148c1135eb1
|
|
| BLAKE2b-256 |
78a2e6cedadc05aea309c819132fcffaddcb9e3c351b038601d8ff26fe002c09
|
Provenance
The following attestation bundles were made for ftllexengine-0.166.0.tar.gz:
Publisher:
publish.yml on resoltico/FTLLexEngine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ftllexengine-0.166.0.tar.gz -
Subject digest:
44698a5806f7edb5d06fa5c9cad91f1d678b8e70243a3a2413dfb586c6986ed4 - Sigstore transparency entry: 1417343661
- Sigstore integration time:
-
Permalink:
resoltico/FTLLexEngine@a4192dde4ca42ddd42a158ef77295519c89f681c -
Branch / Tag:
refs/tags/v0.166.0 - Owner: https://github.com/resoltico
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a4192dde4ca42ddd42a158ef77295519c89f681c -
Trigger Event:
push
-
Statement type:
File details
Details for the file ftllexengine-0.166.0-py3-none-any.whl.
File metadata
- Download URL: ftllexengine-0.166.0-py3-none-any.whl
- Upload date:
- Size: 279.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b065f536c4f7a376ea7f699b05cf0f2aa7b848c51bd0070fa5c9c5f895658c9
|
|
| MD5 |
c75d642aed4bae416cc2d85d905b1ee0
|
|
| BLAKE2b-256 |
1aa6f8bedcf2eb905350be632042fd20f6988dbbcff5096c5c69d130be129d25
|
Provenance
The following attestation bundles were made for ftllexengine-0.166.0-py3-none-any.whl:
Publisher:
publish.yml on resoltico/FTLLexEngine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ftllexengine-0.166.0-py3-none-any.whl -
Subject digest:
1b065f536c4f7a376ea7f699b05cf0f2aa7b848c51bd0070fa5c9c5f895658c9 - Sigstore transparency entry: 1417343691
- Sigstore integration time:
-
Permalink:
resoltico/FTLLexEngine@a4192dde4ca42ddd42a158ef77295519c89f681c -
Branch / Tag:
refs/tags/v0.166.0 - Owner: https://github.com/resoltico
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a4192dde4ca42ddd42a158ef77295519c89f681c -
Trigger Event:
push
-
Statement type: