mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +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,109 @@
|
||||
// K-24: on a failed tool step the voice card shows the English `result.error`
|
||||
// from gevActions under a translated title and step status.
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { setLocale } from '../i18n/index.js';
|
||||
import { attachVoiceResult, spokenLabel } from './speech.js';
|
||||
import {
|
||||
initialVoiceCardState,
|
||||
reduceVoiceCard,
|
||||
voiceCardView,
|
||||
} from './voiceCardPresentation.js';
|
||||
|
||||
// Error texts as gevActions.js builds them (lines 2442, 646–647, 2476).
|
||||
const CASES = [
|
||||
{
|
||||
name: 'frame_overhead',
|
||||
args: { target: 'military' },
|
||||
result: {
|
||||
ok: false,
|
||||
action: 'frame_overhead',
|
||||
layerId: 'military',
|
||||
error: 'The military layer is not enabled',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'select_nearest_aircraft',
|
||||
args: { locationQuery: 'Madrid' },
|
||||
result: {
|
||||
ok: false,
|
||||
action: 'select_nearest_aircraft',
|
||||
stage: 'nearest',
|
||||
cancelled: false,
|
||||
error:
|
||||
'Live Flights is enabled, but no airborne aircraft is loaded in the Madrid view yet',
|
||||
location: { label: 'Madrid' },
|
||||
layer: { label: 'Live Flights' },
|
||||
feed: { state: 'nominal', source: 'OpenSky' },
|
||||
count: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'frame_overhead',
|
||||
args: { target: 'flights' },
|
||||
result: {
|
||||
ok: false,
|
||||
action: 'frame_overhead',
|
||||
layerId: 'flights',
|
||||
radiusKm: 150,
|
||||
count: 0,
|
||||
error: 'No flights within 150 km of the current view',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
function cardFor(locale, { name, args, result }) {
|
||||
setLocale(locale);
|
||||
let state = reduceVoiceCard(initialVoiceCardState(), {
|
||||
type: 'action-call',
|
||||
id: 'c1',
|
||||
name,
|
||||
arguments: args,
|
||||
});
|
||||
state = reduceVoiceCard(state, {
|
||||
type: 'action-result',
|
||||
id: 'c1',
|
||||
name,
|
||||
result: attachVoiceResult(name, result, args),
|
||||
});
|
||||
return voiceCardView(state);
|
||||
}
|
||||
|
||||
for (const locale of ['es', 'ru']) {
|
||||
for (const c of CASES) {
|
||||
test(`${locale}: ${c.name} failure shows the card lines in the UI language`, () => {
|
||||
const view = cardFor(locale, c);
|
||||
try {
|
||||
assert.ok(view.result.visible, 'card shows a result');
|
||||
assert.notEqual(view.result.title, '', 'card has a title');
|
||||
// Title and step status are translated (this part passes today).
|
||||
assert.notEqual(
|
||||
view.steps[0].statusText,
|
||||
'failed',
|
||||
'step status translated',
|
||||
);
|
||||
// The failure line is the raw English tool error.
|
||||
for (const line of view.result.lines) {
|
||||
assert.ok(
|
||||
!/\b(is not enabled|no airborne aircraft|of the current view)\b/.test(
|
||||
line,
|
||||
),
|
||||
`English tool error shown under ${locale} title "${view.result.title}" / step "${view.steps[0].label}: ${view.steps[0].statusText}": "${line}"`,
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
test('en: the card shows the tool error as the model got it', () => {
|
||||
for (const c of CASES) {
|
||||
const view = cardFor('en', c);
|
||||
// Whole, not cut at 80 characters: the card wraps an error line.
|
||||
assert.deepEqual(view.result.lines, [
|
||||
spokenLabel(c.result.error, Infinity),
|
||||
]);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user