Skip to content

projectfluent/fluent

 
 

Repository files navigation

Fluent

Fluent is a localization system designed to unleash the expressive power of the natural language.

This repository contains the specification, the reference implementation of the parser and the documentation for Fluent.

Fluent Syntax

FTL is the syntax for describing translation resources in Project Fluent. FTL stands for Fluent Translation List. Read the Fluent Syntax Guide to get started learning Fluent.

The syntax/spec directory contains the formal EBNF grammar, autogenerated from the reference implementation.

The syntax/parser directory contains the reference implementation of the syntax as a LL(infinity) parser.

Fluent Format

The format/spec directory contains the specification of formatting patterns into strings, including resolving all expressions in placeables.

The format/resolver directory contains the reference implementation of Bundle.formatPattern and the resolver.

Development

The reference resolver is written in TypeScript and must be compiled before tests are run. The reference parser is currently still written in JavaScript.

While working on the reference implementations, use the following commands to test and validate your work:

npm run watch # Run the TypeScript compiler watcher. npm test # Test the parser against JSON AST fixtures, # and test the resolver using the examples # from the spec (the resolver must be compiled). npm run lint # Lint the parser and the resolver code. npm run pretty # Prettify the resolver code. npm run generate:ebnf # Generate the EBNF from syntax/grammar.js. npm run generate:fixtures # Generate test fixtures (FTL → JSON AST). npm run build:impls # Compile the resolver. npm run build:guide # Build the HTML version of the Guide. npm run bench # Run the performance benchmark on large FTL. 

Other Implementations

This repository contains the reference implementation of Fluent. Other implementations exist which should be preferred for use in production and in tooling.

We also know about the following community-driven implementations:

Learn More and Discuss

Find out more about Project Fluent at projectfluent.org and discuss the future of Fluent at Mozilla Discourse.