Expand description
Rebuilding what the tree says when the app changes locale.
An app’s locale is not fixed for the life of the process: a language
menu changes it, and everything the old locale wrote has to be written
again. The spawner left the raw material behind for exactly this, as
AuthoredStrings on every element whose text came from a catalogue or
went through a format, so a switch resolves the same strings against
the catalogue in force now rather than re-reading the markup. A shipped
app has no markup to re-read.
What follows a switch: a marked element’s text, a text entry’s
placeholder, a tooltip’s body, and the output of a format spec. What
does not: a string a script composed and set with set_text on an
element that names no key, and anything built once at startup outside
the tree, such as a native menu or a tray label.
Functions§
- install_
retranslate - Register the rebuild, after the applier that performs the switch, so a locale a script picks lands on the tick it was picked on.
- retranslate_
on_ locale_ change - Resolve every element that kept its authored strings against the locale in force, and write back what changed.