Expand description
§fluent-zero-build
Build-time code generator for fluent-zero.
Call it from build.rs; it compiles the .ftl files of every locale
directory into $OUT_DIR/static_cache.rs, which the consuming crate
include!s at its root.
// In build.rs's `main`:
fluent_zero_build::FluentZeroBuilder::new("assets/locales").generate();FluentZeroBuilder::try_generate reports every failure as an Error
instead of panicking:
use fluent_zero_build::{FluentZeroBuilder, MissingTranslations};
fn main() -> Result<(), fluent_zero_build::Error> {
FluentZeroBuilder::new("assets/locales")
.fallback_locale("en-US")
.missing_translations(MissingTranslations::Deny)
.try_generate()
}Structs§
- Fluent
Zero Builder - A builder to configure and generate the static cache code for
fluent-zero.
Enums§
- Error
- Why
FluentZeroBuilder::try_generatefailed. - Missing
Translations - What the builder does about messages present in the fallback locale but missing from another locale.
Functions§
- generate_
static_ cache - Generates the static cache code for
fluent-zerofromlocales_dir_pathwith the default settings; shorthand forFluentZeroBuilder::new(locales_dir_path).generate().