fluent_i18n/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub mod locale;
4pub use locale::{get_locale, set_locale, set_raw_mode};
5
6mod error;
7pub use error::Error;
8
9mod value;
10pub use value::{FluentValue, ToFluentValue};
11
12mod macros;
13
14/// Re-export the [`fluent_templates`] crate.
15pub use fluent_templates;
16
17// Loads the locale for the crate.
18//
19// NOTE: We use the explicit initialization instead of `i18n!` macro
20// here to avoid importing `fluent_templates` twice.
21#[cfg(not(test))]
22fluent_templates::static_loader! {
23    static LOCALES = {
24        locales: "locales",
25        fallback_language: "en-US",
26        customise: |bundle| bundle.set_use_isolating(false),
27    };
28}
29
30// Loads the locale for the tests.
31//
32//
33// NOTE: We use the explicit initialization instead of `i18n!` macro
34// here to avoid importing `fluent_templates` twice.
35#[cfg(test)]
36fluent_templates::static_loader! {
37    static LOCALES = {
38        locales: "tests/locales",
39        fallback_language: "en-US",
40        customise: |bundle| bundle.set_use_isolating(false),
41    };
42}