Skip to main content

Module i18n

Module i18n 

Structs§

EmbeddedCatalog
An application’s Fluent catalogues, embedded with include_str! and loaded on first use on each thread.
I18nManager
LabelKey
The Fluent message a label, placeholder or button shows: looked up in the active locale when drawn, shown verbatim when no catalog has it.
LanguagePack
Where a catalogue’s other languages come from: the language packs.

Enums§

ArgValue
An owned value to interpolate into a localized message. Owned (rather than a borrowed FluentValue) so callers — most importantly the retained-mode Text widget — can stash arguments alongside a translation key and re-format every frame without keeping the original references alive.
I18nError
PseudoLocale
Layout-stress translation mode used by screenshots and acceptance tests. It deliberately preserves digits and punctuation while expanding letters, making clipped labels and fixed-width controls visible before translators have completed a catalog.

Constants§

IMAGE_LANGUAGE_PACKS
Where the OS image’s language packs are: the language it was installed in.
SANDBOX_LANGUAGE_PACKS
Where a sandboxed app sees the person’s language packs: the launcher binds them here, read-only.

Functions§

follow_configured_language
Select the language the person chose on this thread, when it is not the one selected: a choice made in Settings while the app runs relabels it (the I18nManager::revision moves). With no choice, the system locale; with neither, the source locale.
language_name
tag’s language in its own words, as a language picker offers it: a person looking for their language reads it in that language, once, whatever region the tag adds. A language this build has no name for reads as the tag.
language_of
The language tag names, lower case: de of de-DE. One language pack serves a language, whatever region a tag adds.
language_pack_roots
Where installed language packs are, in the order they are read: the ones the person installed ([tilo_paths::language_packs_dir], or where a sandbox sees them, SANDBOX_LANGUAGE_PACKS), then the image’s.
preferred_language
The language this desktop speaks, as a BCP 47 tag: the one the person chose in Settings, or else the locale the device runs in ([settings_store::appearance::preferred_language]). Every surface and app resolves its language, and the language of the dates it formats, from this one answer.
refresh_language_packs
Read the installed language packs again: one installed since the catalogues loaded (the language a person just chose) is read the next time each catalogue is used.
speak_window_language
Install a package’s catalogues ((locale, Fluent text)) and make this window speak one language: the person’s when the package ships it, the package’s source language otherwise. The toolkit’s own words and the platform’s formats follow the same language, so a window of an app written in one language reads in that language throughout. A host that draws one window on a thread calls this when the package loads; its language stays as the window’s.
window_language
The language a window speaks, chosen once from the person’s preference and the languages what the window shows ships (shipped, the locales of its catalogues): the language they prefer when it is among them, the same language in another region when that is, the source language when it ships that, else the first it ships. One window speaks one language, so an app that ships a translation leaves none of its chrome, its frames’ words or its dates in another. See [tilo_history::window_language].