Switch language in place, without a reload

Choosing a language in the picker now applies it at once. The choice is
stored and ?lang is kept in step through replaceState, and the picker keeps
focus.

Code that writes translated text itself re-presents it on a switch:
onLocaleChange() lets an owner listen, removed at teardown, and status
writers hand over a function of the locale (voice cards, scene director,
SDR, draw hints, imagery split, map sources, Bhote Koshi media) so the
words are rebuilt rather than re-sent. The HUD, cockpit, radio, CCTV,
launch, awareness and credit texts follow the same hook, and
applyDocumentTranslations can be applied again without undoing text code
wrote since.

The unsaved-work registry and persistLocaleAndReload existed only to guard
the reload, so they go, with their catalog entries.
This commit is contained in:
Sameh Khamis committed 2026-11-01 16:47:39 -08:00
1 parent ba20bc13d8
commit b20c80e590
87 files changed
+1194 -777

No files matched your search

+3 -5
View File
@@ -363,12 +363,10 @@ export class RealtimeInput {
updateVoiceButtonLabel() {
if (!this.ui) return;
// The mic button's caption; the first-run tip names it the same way.
this.ui.update('mic', { text: t('MIC') });
this.ui.update('mic', { text: () => t('MIC') });
const { pushToTalkMode, pushToTalkKeyHeld } = this;
this.ui.update('help', {
text: resolveVoiceControlHint(
this.pushToTalkMode,
this.pushToTalkKeyHeld,
),
text: () => resolveVoiceControlHint(pushToTalkMode, pushToTalkKeyHeld),
});
}