feat(i18n): presentation extraction — t() call sites, data-i18n templates, locale selector

Route every application-owned presentation string through the i18n
core: t() call sites across the app/layers/ui/data/voice surfaces,
data-i18n* attributes in the src/ui/templates/*.html markup (applied at
boot by applyDocumentTranslations from src/standalone/application.js),
and the dock locale selector (runtime-rendered from the offered pair —
a single EN button while only English ships).

Rebased onto current main, where the extraction follows the module
splits: the shell wiring now lands in the owner modules
(panelChrome, visualSettings, locationNavigation, shareRestoration,
shellFeedback, applicationShell) and the voice status corpus in the
realtime* modules; scene status lives in director.js +
playbackAdapter.js.

Modules shared with the node runtime (loadingFeedback,
installationFeedback, regionalModel, keySetupCore, vessels ingestion)
stay environment-neutral English and localize at their browser render
sites (chip maps in shellFeedback/installations controls, the weather
table in cockpitBriefing, keySetupRequirementEnvVars compositions), so
the package-boundary graph stays clean; the browser boundary groups
now own the i18n modules they reach (scripts/package-boundaries.json).
This commit is contained in:
Meir Michanie committed 2026-10-01 12:41:20 +02:00
1 parent bde1e430ef
commit 284c4d4601
98 files changed
+3474 -1625

No files matched your search

+22 -14
View File
@@ -44,13 +44,17 @@ export {
import { createRealtimeBackend } from './realtimeBackend.js';
const STATUS = {
idle: 'OFF',
connecting: 'CONNECTING',
listening: 'LISTENING',
executing: 'EXECUTING',
error: 'ERROR',
};
import { t } from '../i18n/index.js';
// Status enum VALUES are machine identifiers (dataset.status, CSS hooks);
// only the LABEL rendered from them localizes, resolved at write time via t().
const STATUS_LABEL_KEYS = Object.freeze({
idle: 'setup.voice.status.idle',
connecting: 'setup.voice.status.connecting',
listening: 'setup.voice.status.listening',
executing: 'setup.voice.status.executing',
error: 'setup.voice.status.error',
});
/** Compose voice state owners and coordinate ordered session startup/teardown. */
export class GevRealtimeController extends RealtimeFacade {
@@ -267,7 +271,7 @@ export class GevRealtimeController extends RealtimeFacade {
this.ui.root.remove();
}
if (!preserveStatus && !removeUi) {
this.setStatus('idle', 'Voice off');
this.setStatus('idle', t('setup.voice.detail.voiceOff'));
}
this.setRadioVoiceDucking(false);
if (removeUi) this.emitSessionEvent({ type: 'disposed' });
@@ -287,24 +291,28 @@ export class GevRealtimeController extends RealtimeFacade {
this.ui.root.dataset.status = status;
if (status === 'error') this.ui.root.classList.remove('error-dismissed');
this.updateVoiceButtonLabel();
this.ui.status.textContent = STATUS[status] || STATUS.idle;
this.ui.status.textContent = t(
STATUS_LABEL_KEYS[status] || STATUS_LABEL_KEYS.idle,
);
const resolvedDetail =
status === 'listening' && this.pushToTalkMode
? this.pushToTalkKeyHeld
? 'Release Space to send'
: 'Hold Space to talk'
? t('setup.voice.detail.releaseSpaceSend')
: t('setup.voice.detail.holdSpaceTalk')
: detail;
const primaryDetail =
status === 'error'
? 'VOICE UNAVAILABLE'
? t('setup.voice.detail.unavailable')
: resolvedDetail ||
(status === 'idle' ? 'VOICE STANDBY' : 'VOICE ACTIVE');
(status === 'idle'
? t('setup.voice.detail.standby')
: t('setup.voice.detail.active'));
this.ui.detail.textContent = primaryDetail;
this.ui.detail.title = primaryDetail;
if (this.ui.errorDetail) {
this.ui.errorDetail.textContent =
status === 'error'
? resolvedDetail || 'Voice session could not be started.'
? resolvedDetail || t('setup.voice.error.sessionStart')
: '';
}
if (status === 'idle' || status === 'connecting' || status === 'error') {