In development. It changes without notice.
Topic
Internationalization
The interface's text by name, in English, Spanish, French, German and Italian.
Every text the owner reads is asked for by its name (i18n::
| Language | Code |
|---|---|
| English | en |
| Español | es |
| Français | fr |
| Deutsch | de |
| Italiano | it |
Files | |
| file | src/ |
| Runtime translation lookup over the compile-time string table. | |
Enumerations | |
| enum class | kleidos:: |
| Supported UI languages. More about kleidos:: | |
Functions | |
| void | kleidos:: |
| Read the chosen language from the device's settings and cache it in RAM. Safe to call once at boot. | |
| bool | kleidos:: |
| Switch the active language and store the choice. | |
| Lang | kleidos:: |
| Return the currently active language. | |
| const char * | kleidos:: |
Translate a generated StringId to a flash-resident UTF-8 string. | |
| const char * | kleidos:: |
| Return the ISO 639-1 short tag for a language. | |
| const char * | kleidos:: |
Return the localized display name for a language ("English", "Espa\u00f1ol", "Fran\u00e7ais", ...). | |
| constexpr uint8_t | kleidos:: |
| Total number of available languages (compile-time constant). | |
| template<typename... Args> | |
| int | kleidos:: |
| Format an i18n string into buf using snprintf. | |
Enumeration Type Documentation
Lang #
Function Documentation
getLang() #
init() #
langCode() #
Return the ISO 639-1 short tag for a language.
- Parameters
-
Name Direction Meaning l in Language to query.
- Returns
- Two-character ISO 639-1 code such as
"en"or"es". Returns"en"for any out-of-range value.
langCount() #
Total number of available languages (compile-time constant).
- Returns
- Number of supported languages (5: EN, ES, FR, DE, IT).
langName() #
Return the localized display name for a language ("English", "Espa\u00f1ol", "Fran\u00e7ais", ...).
- Parameters
-
Name Direction Meaning l in Language to query.
- Returns
- Flash-resident localized name string. Returns
"English"for any out-of-range value.
setLang() #
Switch the active language and store the choice.
- Parameters
-
Name Direction Meaning l in Target language. Values outside [0, ::kLangCount) are ignored silently.
- Return values
-
Value Meaning true The language is active and stored. Always true in the host tests, which have no storage. false lis not a language, and nothing changed; or the interface switched language but the choice was not stored, so the next boot comes back in the old one, which a surface must not report as saved.
tr() #
Translate a generated StringId to a flash-resident UTF-8 string.
Falls back to the English column when id is out of range, the active language is invalid, or the localized string is empty; the caller can therefore render the result unconditionally.
- Parameters
-
Name Direction Meaning id in String identifier to look up.
- Returns
- Flash-resident UTF-8 string; never
nullptr(returns""for unknown ids, which is still safe to render).
trFormat() #
Format an i18n string into buf using snprintf.
The format string is resolved at runtime from the compile-time generated translation table; it is never derived from user input. GCC cannot type-check the variadic arguments against a non-literal format, so -Wformat-nonliteral is suppressed here – in this single, audited location only – which keeps the project-wide warning gate strict (any other non-literal format use still fails the build).
- Template Parameters
-
Name Meaning Args Variadic argument types forwarded to snprintf.
- Parameters
-
Name Direction Meaning buf out Destination buffer. size in Capacity of bufin bytes.id in String identifier for the format template. args in Arguments to format into the template.
- Returns
- Number of bytes that would be written (snprintf semantics); negative on error.