Skip to content

International Language Support

Moonbench edited this page Oct 5, 2026 · 2 revisions

Available languages

The project supports a number of different languages.

Code Language
en English (default)
nl Dutch
it Italian
es Spanish
fr French
de German

Building with a language

To use a different language, you need to compile the project with your preferred language. The rewrites happen at compile time, not runtime, to prevent any performance overhead on the running devices.

Language selection is done through Cargo features. Each language has a matching lang-<code> feature on both the firmware and desktop crates. English is the default.

Firmware, C6, Spanish:

cargo run --release --no-default-features --features "c6 lang-es"

Firmware, C3, French:

cargo run --release --no-default-features --features "c3 lang-fr" --target riscv32imc-unknown-none-elf

Desktop, German (example on Apple Silicon):

cargo run -p catode32-desktop --no-default-features --features lang-de --target aarch64-apple-darwin

How it works

All player-visible strings are marked with the t!("...") macro in the source code. At build time, the catode32-i18n-macros crate rewrites each t! call into the translated string literal for the active language. The compiled binary contains only baked string values. No translation table is loaded at runtime, so there is zero memory or performance overhead on the device.

Translation lookup order per string: language file → English fallback → key itself. This means a partial translation file is valid; any untranslated key silently falls back to English.

Adding a new language

  1. Create crates/i18n-macros/translations/<code>.json
  2. Copy any keys from en.json whose values you want to translate, and replace the values with the translated text. Keys you omit fall back to English automatically.
  3. Add a matching lang-<code> feature to crates/i18n-macros/Cargo.toml, crates/core/Cargo.toml, crates/firmware/Cargo.toml, and crates/desktop/Cargo.toml, following the pattern used for the existing languages.
  4. Extend the language dispatch in crates/i18n-macros/src/lib.rs to recognise the new lang-<code> feature.
  5. Build with --features lang-<code> as shown above.

Clone this wiki locally