Skip to main content

resolve_strings

Function resolve_strings 

Source
pub fn resolve_strings(
    i18n: Option<&AppI18n>,
    authored: &AuthoredStrings,
    format: Option<&str>,
) -> TranslatedStrings
Expand description

The strings an element shows in the app’s locale.

A translatable="key" element reads each of them off the catalogue message that key names, which is lumen_ir::translate::translate’s rule, shared with the web emitter so a page built for a locale reads like the app run in it. The spawner uses three of the four it returns; nothing on the desktop reads alt.

A format="<spec>" then renders whatever text is left for the app’s locale. Both the catalogue and the formatter come off lumen_core::i18n::AppI18n, the app’s own half of the seam, rather than the process-wide hooks the script hosts use: a process running two Lumen apps must not render one app’s markup in the other’s locale. Text the spec cannot read stands as it is, so a translated sentence under a number format is still the sentence.

The spawner calls this once per element, and crate::i18n::retranslate_on_locale_change calls it again for every element that kept its AuthoredStrings when the app changes locale. One rule, asked twice.