Expand description
§es-fluent-cli
The official command-line tool for es-fluent.
This tool automatically manages your Fluent (.ftl) translation files by analyzing your Rust code. It finds types with #[derive(EsFluent)] and creates corresponding message entries, so you don’t have to keep them in sync manually.
§Installation
cargo install es-fluent-cli§Commands
Ensure you have an i18n.toml in your crate root:
assets_dir = "i18n"
fallback_language = "en-US"§Generate
When you add new localizable structs or enums to your code, run:
es-fluent generateThis will:
- Scan your
src/directory. - Update
i18n/en-US/{your_crate}.ftl.- New items: Added as new messages.
- Changed items: Variables updated (e.g. if you added a field).
- Existing translations: Preserved untouched.
Use --dry-run to preview changes without writing them.
§Watch
Same as generate, but runs in watch mode, updating FTL files as you type:
es-fluent watch§Check
To ensure all your translations are valid and no keys are missing:
es-fluent checkUse --all to check all locales, not just the fallback language.
§Clean
Remove orphan keys and groups that are no longer present in your source code:
es-fluent cleanUse --dry-run to preview changes without writing them.
§Format
Standardize the formatting of your FTL files using fluent-syntax rules:
es-fluent formatUse --dry-run to preview changes without writing them. Use --all to format all locales.
§Sync
Propagate keys from your fallback language to other languages (e.g., from en-US to fr and de), creating placeholders for missing translations:
es-fluent syncUse --locale <LANG> to sync a specific locale, or --all to sync all locales, --dry-run to preview changes without writing them.