Skip to main content

translate

Function translate 

Source
pub fn translate(
    authored: &AuthoredStrings,
    lookup: &dyn Fn(&str) -> Option<String>,
) -> TranslatedStrings
Expand description

Every string authored shows, resolved through lookup.

lookup answers a catalogue key with the message it holds, or None when it holds none - lumen_i18n::SharedI18n::try_t and lumen_core::i18n::AppI18n::try_translate are the two that do.

Only a string the markup authored is translated. A catalogue entry for key.placeholder on an element with no placeholder does nothing, which is the same rule lumenc i18n extract applies from the other side, so what the extractor writes is exactly what resolves.