Skip to main content

retranslate_on_locale_change

Function retranslate_on_locale_change 

Source
pub fn retranslate_on_locale_change(
    i18n: Option<Res<'_, AppI18n>>,
    q: Query<'_, '_, (&'static AuthoredStrings, Option<&'static TextFormat>, Option<&'static mut TextContent>, Option<&'static mut TextInput>, Option<&'static mut TooltipSource>, Option<&'static Focused>), Without<BindText>>,
)
Expand description

Resolve every element that kept its authored strings against the locale in force, and write back what changed.

Gated on AppI18n being marked changed, which is what the applier does when it switches the locale through a ResMut borrow. A steady tick costs one flag read.

An element carrying a bind-text is left alone: it belongs to its signal, and lumen_core::signals::apply_text_bindings refreshes it on the same tick. [write_strings] says what a focused entry keeps.