Introduction
es-fluent is a localization (i18n) ecosystem for Rust built on top of Project Fluent. It provides type-safe, ergonomic derive macros to link your Rust types directly to Fluent .ftl translation files.
The core philosophy:
- Type Safety: Your code and translation files stay in sync — mismatches are caught at compile time.
- Ergonomics: A single
#[derive(EsFluent)]on a struct or enum is all you need. - Developer Experience: A CLI generates FTL file skeletons, validates keys, and keeps everything consistent.
What This Book Covers
- Workspace Crates — Which crates you depend on directly and which support crates you usually won’t need directly.
- Getting Started — Installation, configuration, and a working end-to-end example.
- Deriving Messages — Mapping structs and enums to FTL message keys using
EsFluent,EsFluentChoice,EsFluentVariants, andEsFluentLabel. - Namespaces & File Splitting — Organizing translations into multiple FTL files.
- Language Enum — Auto-generating a type-safe
Languagesenum from your locale folders. - Runtime Managers — Loading and resolving translations at runtime with the embedded, Dioxus, or Bevy manager.
- CLI Tooling — Generating, validating, syncing, cleaning, formatting, and inspecting FTL files from the command line.
- Incremental Builds — Ensuring Cargo rebuilds when locale files change.