mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
i18n: fix review findings and polish ru/es strings
Fixes the 51 P0–P2 findings from the full review of the i18n branch and the issues found while checking every new string on screen in ru and es. - Translate errors and statuses that still reached ru/es in English: feed and tile errors, provider statuses, the ALPR chip, the traffic mode chip, voice plan step labels, fire feed values, receiver bands, scene save reasons and the Cesium attribution link. - Show preset city names in the UI language (src/ui/placeNames.js); data and everything sent to the model stay English. - Share layer names between the layer panel, HUD and voice card (src/ui/layerNames.js). - Keep long ru/es strings whole: voice card error lines, analyst titles, the voice tier status, the Nepal evidence button, the ALPR retry chip. English layout is unchanged. - Ask before a language switch drops unsaved work. - Catalog fixes: glossary terms (пуск, пресет), gender agreement and consistent "peticiones" in es, fewer calques in both languages. - Fix English text that was itself wrong (e.g. "Exit cockpit to fly to a weather", raw tool ids in voice plan steps). Catalogs: es/ru 2535 messages each, complete. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8029747b7e
commit
00704ddc89
212 files changed
+9871
-909
No files matched your search
@@ -0,0 +1,108 @@
|
||||
// Shell toasts, prompts and launcher labels that reach the page through
|
||||
// `showToast?.(`, `this._showToast(`, `window.prompt/confirm` or a constant
|
||||
// are invisible to the unmarked-text checker, so pin them here: marked in the
|
||||
// code, present in every shipped catalog, and no bare literal left at the
|
||||
// call sites.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import {
|
||||
extractMessages,
|
||||
readCatalog,
|
||||
shippedLocales,
|
||||
} from '../../scripts/i18n.mjs';
|
||||
import { setLocale } from '../i18n/index.js';
|
||||
import {
|
||||
beginDeferredNavigation,
|
||||
reassertNavigationHandoff,
|
||||
runExplicitNavigation,
|
||||
} from '../navigationPolicy.js';
|
||||
|
||||
const KEYS = [
|
||||
'Tilted view',
|
||||
'Straight-down view',
|
||||
'North up',
|
||||
'Exit cockpit to fly to a camera',
|
||||
'Exit cockpit to fly to a location',
|
||||
'Exit cockpit to fly to a photo',
|
||||
'Exit cockpit to fly to a shared view',
|
||||
'Exit cockpit to fly to a {noun}',
|
||||
'Go to expanded Radio section',
|
||||
'Expand Radio section in Context',
|
||||
'Double-click the header to snap the panel back',
|
||||
'New scene name',
|
||||
'Delete scene "{scene}" and all shots?',
|
||||
'Detailed outline unavailable',
|
||||
];
|
||||
|
||||
const messages = extractMessages();
|
||||
|
||||
for (const key of KEYS) {
|
||||
test(`marked for translation: ${key}`, () => {
|
||||
assert.ok(messages.has(key), `not marked with t()/msg(): ${key}`);
|
||||
});
|
||||
for (const locale of shippedLocales()) {
|
||||
test(`${locale} catalog translates: ${key}`, () => {
|
||||
const value = readCatalog(locale)[key];
|
||||
assert.ok(value, `missing in ${locale}.json`);
|
||||
assert.notEqual(value, key);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
test('no bare literal reaches showToast in the orientation and navigation code', () => {
|
||||
for (const file of [
|
||||
'../ui/cameraOrientationControls.js',
|
||||
'../navigationPolicy.js',
|
||||
'../ui/locationNavigation.js',
|
||||
'../ui/panelPositionControls.js',
|
||||
]) {
|
||||
const source = readFileSync(
|
||||
fileURLToPath(new URL(file, import.meta.url)),
|
||||
'utf8',
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
source,
|
||||
/_?showToast\??\.?\(\s*['"`]/,
|
||||
`${file} passes a bare literal to showToast`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test.afterEach(() => setLocale('en'));
|
||||
|
||||
test('the Cockpit refusal keeps its English wording per noun', () => {
|
||||
setLocale('en');
|
||||
const log = [];
|
||||
const showToast = (text) => log.push(text);
|
||||
runExplicitNavigation({ cockpitActive: true, noun: 'camera', showToast });
|
||||
beginDeferredNavigation({ cockpitActive: true, showToast });
|
||||
reassertNavigationHandoff({
|
||||
generation: 1,
|
||||
currentGeneration: 1,
|
||||
cockpitActive: true,
|
||||
showToast,
|
||||
});
|
||||
runExplicitNavigation({ cockpitActive: true, noun: 'contact', showToast });
|
||||
assert.deepEqual(log, [
|
||||
'Exit cockpit to fly to a camera',
|
||||
'Exit cockpit to fly to a location',
|
||||
'Exit cockpit to fly to a location',
|
||||
'Exit cockpit to fly to a contact',
|
||||
]);
|
||||
});
|
||||
|
||||
for (const locale of ['es', 'ru']) {
|
||||
test(`${locale}: the Cockpit refusal is translated`, () => {
|
||||
setLocale(locale);
|
||||
const log = [];
|
||||
runExplicitNavigation({
|
||||
cockpitActive: true,
|
||||
noun: 'camera',
|
||||
showToast: (text) => log.push(text),
|
||||
});
|
||||
assert.equal(log.length, 1);
|
||||
assert.doesNotMatch(log[0], /Exit cockpit/);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user