Repository navigation
International Language Support
The project supports a number of different languages.
| Code | Language |
|---|---|
en |
English (default) |
nl |
Dutch |
it |
Italian |
es |
Spanish |
fr |
French |
de |
German |
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-elfDesktop, German (example on Apple Silicon):
cargo run -p catode32-desktop --no-default-features --features lang-de --target aarch64-apple-darwinAll 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.
- Create
crates/i18n-macros/translations/<code>.json - Copy any keys from
en.jsonwhose values you want to translate, and replace the values with the translated text. Keys you omit fall back to English automatically. - Add a matching
lang-<code>feature tocrates/i18n-macros/Cargo.toml,crates/core/Cargo.toml,crates/firmware/Cargo.toml, andcrates/desktop/Cargo.toml, following the pattern used for the existing languages. - Extend the language dispatch in
crates/i18n-macros/src/lib.rsto recognise the newlang-<code>feature. - Build with
--features lang-<code>as shown above.