no bug - Correct some typos in the comments. a=typo-fix
[gecko.git] / third_party / rust / fluent-fallback / README.md
blob25f9350f2e4a0c5c04521fdc0390a05703097e4d
1 # Fluent
3 `fluent-fallback` is a Rust implementation of the [Project Fluent][] higher level API.
5 The `Localization` struct encapsulates a persistant localization context providing
6 language fallbacking. The instance remains available throughout the whole life cycle of
7 the corresponding UI, reacting to events such as locale changes, resource updates etc.
9 The API can be used directly, or can serve as an example of state manager for `fluent-bundle` and `fluent-resmgr`. 
11 [![crates.io](https://img.shields.io/crates/v/fluent-fallback.svg)](https://crates.io/crates/fluent-fallback)
12 [![Build and test](https://github.com/projectfluent/fluent-rs/workflows/Build%20and%20test/badge.svg)](https://github.com/projectfluent/fluent-rs/actions?query=branch%3Amaster+workflow%3A%22Build+and+test%22)
13 [![Coverage Status](https://coveralls.io/repos/github/projectfluent/fluent-rs/badge.svg?branch=master)](https://coveralls.io/github/projectfluent/fluent-rs?branch=master)
15 Project Fluent keeps simple things simple and makes complex things possible.
16 The syntax used for describing translations is easy to read and understand.  At
17 the same time it allows, when necessary, to represent complex concepts from
18 natural languages like gender, plurals, conjugations, and others.
20 [Documentation][]
22 [Project Fluent]: http://projectfluent.org
23 [Documentation]: https://docs.rs/fluent/
25 Usage
26 -----
28 ```rust
29 use fluent_fallback::Localization;
31 fn main() {
32     // generate_messages is a closure that returns an iterator over FluentBundle
33     // instances.
34     let loc = Localization::new(vec!["simple.ftl".into()], generate_messages);
36     let value = bundle.format_value("hello-world", None);
38     assert_eq!(&value, "Hello, world!");
40 ```
43 Status
44 ------
46 The implementation is in its early stages and supports only some of the Project
47 Fluent's spec.  Consult the [list of milestones][] for more information about
48 release planning and scope.
50 [list of milestones]: https://github.com/projectfluent/fluent-rs/milestones
53 Local Development
54 -----------------
56     cargo build
57     cargo test
58     cargo run --example simple-fallback
60 When submitting a PR please use  [`cargo fmt`][] (nightly).
62 [`cargo fmt`]: https://github.com/rust-lang-nursery/rustfmt
65 Learn the FTL syntax
66 --------------------
68 FTL is a localization file format used for describing translation resources.
69 FTL stands for _Fluent Translation List_.
71 FTL is designed to be simple to read, but at the same time allows to represent
72 complex concepts from natural languages like gender, plurals, conjugations, and
73 others.
75     hello-user = Hello, { $username }!
77 [Read the Fluent Syntax Guide][] in order to learn more about the syntax.  If
78 you're a tool author you may be interested in the formal [EBNF grammar][].
80 [Read the Fluent Syntax Guide]: http://projectfluent.org/fluent/guide/
81 [EBNF grammar]: https://github.com/projectfluent/fluent/tree/master/spec
84 Get Involved
85 ------------
87 `fluent-rs` is open-source, licensed under the Apache License, Version 2.0.  We
88 encourage everyone to take a look at our code and we'll listen to your
89 feedback.
92 Discuss
93 -------
95 We'd love to hear your thoughts on Project Fluent! Whether you're a localizer
96 looking for a better way to express yourself in your language, or a developer
97 trying to make your app localizable and multilingual, or a hacker looking for
98 a project to contribute to, please do get in touch on the mailing list and the
99 IRC channel.
101  - Discourse: https://discourse.mozilla.org/c/fluent
102  - IRC channel: [irc://irc.mozilla.org/l20n](irc://irc.mozilla.org/l20n)