mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
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:
1 parent
bde1e430ef
commit
284c4d4601
98 files changed
+3474
-1625
No files matched your search
@@ -17,6 +17,8 @@
|
||||
* for), then the constellations users can actually name, then the grab-bag.
|
||||
*/
|
||||
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
/**
|
||||
* Class registry. `label` is the card/legend token, `color` the point color,
|
||||
* `blurb` the plain-language gloss for the legend tooltip.
|
||||
@@ -77,6 +79,32 @@ export const SATELLITE_CLASS_ORDER = Object.freeze([
|
||||
'comms',
|
||||
]);
|
||||
|
||||
// Display keys for the class table above: `label`/`blurb` stay the English
|
||||
// source-of-truth tokens (tests read them), while the card and legend accessors
|
||||
// translate through these keys at the presentation boundary.
|
||||
const CLASS_DISPLAY_KEYS = Object.freeze({
|
||||
station: Object.freeze({
|
||||
label: 'layers.satellites.class.station',
|
||||
blurb: 'layers.satellites.class.stationBlurb',
|
||||
}),
|
||||
nav: Object.freeze({
|
||||
label: 'layers.satellites.class.nav',
|
||||
blurb: 'layers.satellites.class.navBlurb',
|
||||
}),
|
||||
geo: Object.freeze({
|
||||
label: 'layers.satellites.class.geo',
|
||||
blurb: 'layers.satellites.class.geoBlurb',
|
||||
}),
|
||||
visual: Object.freeze({
|
||||
label: 'layers.satellites.class.visual',
|
||||
blurb: 'layers.satellites.class.visualBlurb',
|
||||
}),
|
||||
comms: Object.freeze({
|
||||
label: 'layers.satellites.class.comms',
|
||||
blurb: 'layers.satellites.class.commsBlurb',
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* CelesTrak group tag → { class, subtype }. Subtype names the specific
|
||||
* constellation so the card can read "NAV · GPS" rather than a bare "NAV".
|
||||
@@ -139,7 +167,7 @@ export function satelliteClassColor(group) {
|
||||
*/
|
||||
export function satelliteClassLabel(group, { isIss = false } = {}) {
|
||||
const { klass, subtype } = satelliteClassOf(group, { isIss });
|
||||
const base = SATELLITE_CLASSES[klass].label;
|
||||
const base = t(CLASS_DISPLAY_KEYS[klass].label);
|
||||
return subtype ? `${base} · ${subtype}` : base;
|
||||
}
|
||||
|
||||
@@ -180,11 +208,12 @@ export function satelliteClassLegend(counts) {
|
||||
const count = counts?.[klass];
|
||||
if (!(count > 0)) continue;
|
||||
const spec = SATELLITE_CLASSES[klass];
|
||||
const display = CLASS_DISPLAY_KEYS[klass];
|
||||
result.push({
|
||||
klass,
|
||||
label: spec.label,
|
||||
label: t(display.label),
|
||||
color: spec.color,
|
||||
blurb: spec.blurb,
|
||||
blurb: t(display.blurb),
|
||||
count,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user