Skip to main content
https://badge.fury.io/py/fluent-compiler.svg https://readthedocs.org/projects/fluent-compiler/badge/?version=latest&style=flat https://github.com/django-ftl/fluent-compiler/workflows/Python%20package/badge.svg

This is a Python implementation of Project Fluent, a localization framework designed to unleash the entire expressive power of natural language translations.

It provides a different implementation from the official fluent.runtime implementation, distinguished mainly by:

  • strategy: we compile FTL files to Python bytecode via AST and use exec (similar to the strategy used by projects like Mako, Jinja2 and Genshi).

  • speed: as a result of the above, plus static analysis, we get blazing fast performance, even more so when combined with PyPy which can further optimize.

  • compile-time checking and error reporting.

  • ‘escapers’ feature for handling things like HTML escaping/embedding correctly.

Installation

To install:

pip install fluent_compiler

Usage

See the docs folder or read them on readthedocs.org.

If you are using Django, see django-ftl which wraps the functionality here in Django-specific ways.

See history for a CHANGELOG.

Status

fluent-compiler is a complete and very mature implementation of all the Fluent spec up to version 1.0 (the latest at the time of writing).

In terms of API of this package, we are not planning backwards incompatible changes to the publicly documented interfaces, and will provide deprecation warnings for any changes.

The nature of the library is such that we expect most users will want to create their own wrappers anyway, which you are encouraged to do, in order to be able to absorb any backwards incompatible changes easily.

See the issues list for planned features, and CONTRIBUTING.rst for information about how to contribute, and the architecture docs.

Contributing

Check out the contributing docs and the architecture notes for information that will help you before you start hacking.

Background

This code was originally developed as part of fluent.runtime, as an alternative implementation of FluentBundle, but never got merged to the master branch. It has now been pulled out as a separate package. This is why the repo’s history contains fluent.syntax and early versions of fluent.runtime, but the parts that are left in this repo all derive from the original version of fluent.runtime contributed by @spookylukey from a540993a085e36a9679e12f1ee7317ddc1ece5ad onwards and the new compiler implementation in d1481d61e0bc1a28a228a4b6d5258350d436e765 (which is squashed version of work done over a much longer period). Thats why we also corrected the copyright notice from Mozilla to Luke Plant.

Release files for fluent-compiler 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fluent-compiler 1.1
File Size Uploaded
fluent_compiler-1.1.tar.gz 83.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fluent-compiler 1.1
File Interpreter ABI Platform
fluent_compiler-1.1-py3-none-any.whl Python 3 none any Details

Total release size: 121.0 kB

Release files / fluent_compiler-1.1.tar.gz

Download URL fluent_compiler-1.1.tar.gz
Size 83.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7ab34182b7ef616233457bc7d17eca830aa8faa4685eed7e4498968d63cdf14e
BLAKE2b-256 checksum
How to use checksums
df32b51e4b5708412ccd3bec1060216c711a5a36da3814346b1799652a9051af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / fluent_compiler-1.1-py3-none-any.whl

Download URL fluent_compiler-1.1-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67486e9e12394c9c38c89705171ee965ca8163684ebaeff019d0fa23945e9827
BLAKE2b-256 checksum
How to use checksums
ef5cf6fcde75c59a54209ee3a109d84506e82f55e24e77a3df0e2d5755b8a4b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files

1.0

2 release files

0.4

2 release files

0.3

3 release files

0.2

3 release files

0.1.1

3 release files

0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page