mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
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]>
80 lines
2.3 KiB
JavaScript
80 lines
2.3 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { setLocale, translateKnown } from '../../i18n/index.js';
|
|
import { createControls } from './controls.js';
|
|
|
|
function stats(state) {
|
|
const layerState = { records: [], enabled: true, ...state };
|
|
return createControls({
|
|
state: layerState,
|
|
services: {},
|
|
parts: {},
|
|
source: {},
|
|
}).methods.getStats();
|
|
}
|
|
|
|
for (const locale of ['es', 'ru']) {
|
|
test(`${locale}: installation feedback is in the UI language`, () => {
|
|
setLocale(locale);
|
|
const empty = stats({ status: 'empty', lastUpdate: 1 }).statusMessage;
|
|
assert.notEqual(empty, 'No mapped sites in view');
|
|
const found = stats({
|
|
status: 'ready',
|
|
lastUpdate: 1,
|
|
records: [{ kind: 'installation' }, { kind: 'installation' }],
|
|
}).statusMessage;
|
|
assert.notEqual(found, '2 mapped sites in view');
|
|
const tiles = stats({
|
|
status: 'unavailable',
|
|
failureReason: 'tiles_unavailable',
|
|
}).statusMessage;
|
|
assert.notEqual(tiles, 'Map tiles temporarily unavailable');
|
|
const retry = stats({
|
|
status: 'unavailable',
|
|
failureReason: 'names_unavailable',
|
|
retryAt: Date.now() + 5000,
|
|
}).statusMessage;
|
|
assert.doesNotMatch(retry, /^Mapped names temporarily unavailable/);
|
|
for (const text of [
|
|
'Too many mapped sites in view to list them all',
|
|
'Installation context unavailable',
|
|
]) {
|
|
assert.notEqual(translateKnown(text), text);
|
|
}
|
|
});
|
|
}
|
|
|
|
test('en: installation feedback keeps its English wording', () => {
|
|
setLocale('en');
|
|
assert.equal(
|
|
stats({ status: 'empty', lastUpdate: 1 }).statusMessage,
|
|
'No mapped sites in view',
|
|
);
|
|
assert.equal(
|
|
stats({
|
|
status: 'ready',
|
|
lastUpdate: 1,
|
|
records: [{ kind: 'installation' }],
|
|
}).statusMessage,
|
|
'1 mapped site in view',
|
|
);
|
|
assert.equal(
|
|
stats({
|
|
status: 'ready',
|
|
lastUpdate: 1,
|
|
wide: true,
|
|
coverage: { kind: 'subject', radiusM: 25000 },
|
|
records: [{ kind: 'installation' }, { kind: 'installation' }],
|
|
}).statusMessage,
|
|
'2 mapped sites within 25 km of the contact',
|
|
);
|
|
assert.equal(
|
|
stats({
|
|
status: 'unavailable',
|
|
failureReason: 'names_unavailable',
|
|
retryAt: Date.now() + 5000,
|
|
}).statusMessage,
|
|
'Mapped names temporarily unavailable — retrying in 5s',
|
|
);
|
|
});
|