Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

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

  1. Workspace Crates — Which crates you depend on directly and which support crates you usually won’t need directly.
  2. Getting Started — Installation, configuration, and a working end-to-end example.
  3. Deriving Messages — Mapping structs and enums to FTL message keys using EsFluent, EsFluentChoice, EsFluentVariants, and EsFluentLabel.
  4. Namespaces & File Splitting — Organizing translations into multiple FTL files.
  5. Language Enum — Auto-generating a type-safe Languages enum from your locale folders.
  6. Runtime Managers — Loading and resolving translations at runtime with the embedded, Dioxus, or Bevy manager.
  7. CLI Tooling — Generating, validating, syncing, cleaning, formatting, and inspecting FTL files from the command line.
  8. Incremental Builds — Ensuring Cargo rebuilds when locale files change.