Function slint::update_all_translations

Function Documentation

inline void slint::update_all_translations()

Forces all the strings that are translated with @tr(...) to be re-evaluated. This is useful if the language is changed at runtime. The function is only available when Slint is compiled with SLINT_FEATURE_GETTEXT.

Example

 my_ui->global<LanguageSettings>().on_french_selected([] {
    // trick from https://www.gnu.org/software/gettext/manual/html_node/gettext-grok.html
    setenv("LANGUAGE", langs[l], true);
    extern int _nl_msg_cat_cntr;
    ++_nl_msg_cat_cntr;
    slint::update_all_translations();
});