mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
ba20bc13d8
commit
b20c80e590
87 files changed
+1194
-777
No files matched your search
+11
-1
@@ -9,7 +9,14 @@
|
||||
* rail-card blocks and cards. Source toggles live on the data-panel row.
|
||||
*/
|
||||
import { h, render as renderVue } from 'vue';
|
||||
import { formatNumber, msg, t, tn, translateKnown } from '../i18n/index.js';
|
||||
import {
|
||||
formatNumber,
|
||||
msg,
|
||||
onLocaleChange,
|
||||
t,
|
||||
tn,
|
||||
translateKnown,
|
||||
} from '../i18n/index.js';
|
||||
import { createImagerySplit } from './imagerySplit.js';
|
||||
import RecentImageryReadout from './recentImagery/RecentImageryReadout.vue';
|
||||
import {
|
||||
@@ -936,6 +943,8 @@ export function createRecentImageryPanel({
|
||||
render();
|
||||
}
|
||||
});
|
||||
// The readout's text is translated here; show it again in a new locale.
|
||||
const offLocale = onLocaleChange(render);
|
||||
render();
|
||||
|
||||
return {
|
||||
@@ -945,6 +954,7 @@ export function createRecentImageryPanel({
|
||||
if (destroyed) return;
|
||||
destroyed = true;
|
||||
unsubscribe();
|
||||
offLocale();
|
||||
layer.setToolHandler?.(null);
|
||||
split?.destroy();
|
||||
split = null;
|
||||
|
||||
Reference in new issue
Block a user