Skip to content
  1. Docs
  2. enzimOS
  3. Developers

Localization

How enzimOS components embed Fluent catalogues, negotiate the UI language, and how to add or translate messages.

enzimOS components use the enzUI framework's localization layer: Fluent catalogues for messages and ICU4X/CLDR data for dates, times and numbers. Each application embeds its own catalogues, and the framework embeds translations for its own widgets. Nothing is downloaded at runtime and no generated system locale is needed, so packaged and standalone builds work offline.

Where the catalogues live

ComponentCataloguesLanguages
Shell, Settings, lock screenshell/src/locales/ in enzimos-shellen-US, es
Storelocales/ in storeen-US, es
Terminallocales/ in terminalen-US, es
Recoveryassets/locales/ in recoveryen-US, es
Installerassets/locales/ in installeren-US, es, de, fr, hu, it, nl, pl, pt, sv

English is the source language and the fallback. In the installer, Spanish covers every message; the other languages predate newer installer text, which falls back to English until translated.

Language selection

Shell. The desktop language is stored as language in the shell settings file, with the values en-US, es or auto (Follow system). Settings, the shell and the bar switch without a restart. The lock screen and helper apps read the same profile when they start. The installed greeter uses its own profile or the system language; it never reads private files from unauthenticated accounts.

Store, Terminal and Recovery read the standard Linux UI language variables at startup: LANGUAGE, LC_MESSAGES and LANG, subject to LC_ALL. A C or POSIX locale disables LANGUAGE. Regional Spanish locales such as es_MX negotiate the generic es catalogue. To try an app in Spanish:

sh
LANG=es_ES.UTF-8 LANGUAGE=es store-app

Installer has its own language selector and also follows the desktop language at startup. Changing the language refreshes labels without changing entered values, explicit keyboard and time-zone choices, or the selected disk.

Wallpaper. The enzwall renderer formats named date fields in scene templates with the same framework formatters. The shell passes ENZUI_LOCALE and restarts the renderer when the language changes.

How an app maps messages

Applications that predate localization keep their English source strings in code. A small adapter maps each fixed English string to a stable Fluent ID, built once into a catalogue:

rust
fn catalog() -> Catalog {
    static CATALOG: OnceLock<Catalog> = OnceLock::new();
    CATALOG
        .get_or_init(|| {
            let mut builder = CatalogBuilder::new();
            builder
                .add_resource("en-US", include_str!("../locales/en-US.ftl"))
                .expect("valid bundled translations");
            builder
                .add_resource("es", include_str!("../locales/es.ftl"))
                .expect("valid bundled translations");
            builder.build()
        })
        .clone()
}

const MESSAGES: &[(&str, &str)] = &[
    ("About this app", "app-about-this-app-147cb2"),
    ("Activity", "app-activity-38da15"),
    // …
];

This is the Store's src/i18n.rs. Strings with no mapping are shown unchanged. Static presentation getters share one bounded label cache filled at startup; the installer, which changes language live, uses a language-local cache that is refreshed on selection.

The shell uses enzui_core::localization directly, with Localizer::view for root views and overlays. Each root view keeps its localization scope through overlays, painting and accessibility. Background work does not inherit that thread-local scope: pass the localizer explicitly, or translate results at the UI boundary.

Writing messages

Catalogues are UTF-8 Fluent files. Pass inserted values as named arguments, and keep plural forms in the catalogue:

text
app-app-count = { $count ->
    [one] { $count } app
   *[other] { $count } apps
}
text
app-app-count = { $count ->
    [one] { $count } aplicación
   *[other] { $count } aplicaciones
}

Rules for messages:

  • Keep message IDs and argument names stable. Translators change only the values.
  • Write whole sentences. Avoid fragments assembled in code; use named arguments and Fluent selectors instead.
  • Pluralized counts use numeric arguments. Values inserted into messages keep their types through MessageArgument.
  • Treat formatted output as display text, including its bidi isolation characters.
  • Give translated controls explicit, stable widget IDs.

Some text is never translated: third-party application content, account and file names, notifications already received, and diagnostic excerpts such as command output.

Adding a message

  1. Add the English text to locales/en-US.ftl with a new ID.
  2. Add the translation with the same ID and arguments to locales/es.ftl (and any other catalogues the app ships).
  3. For adapter-based apps, add the (source, id) pair to the source mapping.
  4. Run the app's catalogue test.

Tests

Each app has one catalogue boundary test. It resolves every mapped message in Spanish, substituting every argument found in the English resource, and fails if a message falls back to English or reports a Fluent error. The Store also checks representative plural counts. The shell's tests cover both languages, formatting arguments, Spanish dates and canonical shortcut round trips.

These tests protect the app's own resources; framework catalogue coverage stays upstream. After a framework update, run the existing app workflows, and check a real Spanish view when presentation changes.

Saved state and renames

Saved-state files keep the enzui-iced envelope even though crate names now use enzui-*, and loaders still accept the transitional enzui envelope. Keep application format IDs and versions unchanged during package renames, so users do not lose settings or sessions because a dependency namespace changed.