mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
i18n: fix the repeat-review findings
- Status pieces translate in one place (src/ui/statusText.js): a Local
ADS-B error with a single piece now translates, and the analyst card
splits empty-layer notes into pieces (Transit, Local ADS-B).
- Translate the ALPR retry chip text, the ECCC error on the Air quality
card, "Upstream response too large" and the "entry {n}" feed label.
- The unmarked-text check also sees error/loadingLabel/statusMessage/
status assignments, `status:` properties and showToast?.( /
this._showToast( calls; the scene import preview marks its pack
statuses, data and model-facing text carry i18n-ignore with a reason.
- Tests check the real code: the HUD locality formatter moves to
src/hudLocalityFormat.js, the unsaved-keys test pins the teardown.
- One copy each: city names come from src/cityPois.js, the GNSS HTTP
template and wind "field unavailable" texts; dead fallbacks removed.
- Leftovers of the reverted vessel-label change and the reformatting of
detectionHost.test.mjs / keySetup.test.mjs are back to main.
Catalogs: es/ru 2617 messages each, complete.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
a2463ca2d2
commit
3157888780
60 files changed
+1577
-1606
No files matched your search
@@ -0,0 +1,80 @@
|
||||
// The analyst card's empty notes can be a layer's status line: Local ADS-B
|
||||
// with every decoder feed stale, Transit with a quiet feed ("(95s old)"). The
|
||||
// card shows them in the UI language; the model gets the English.
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { setLocale } from '../i18n/index.js';
|
||||
import { attachVoiceResult } from './speech.js';
|
||||
import {
|
||||
initialVoiceCardState,
|
||||
reduceVoiceCard,
|
||||
voiceCardView,
|
||||
} from './voiceCardPresentation.js';
|
||||
|
||||
function notesFor(layerKey, caveat) {
|
||||
const shaped = attachVoiceResult(
|
||||
'analyst_query',
|
||||
{
|
||||
ok: true,
|
||||
count: 0,
|
||||
complete: true,
|
||||
scopeLabel: 'in view',
|
||||
feedState: 'nominal',
|
||||
unanswered: [],
|
||||
coverage: { layersQueried: [{ layerKey, status: 'empty' }] },
|
||||
display: { scope: 'in view', caveat },
|
||||
items: [],
|
||||
},
|
||||
{},
|
||||
);
|
||||
return voiceCardView(
|
||||
[
|
||||
{
|
||||
type: 'action-call',
|
||||
callId: 'c1',
|
||||
name: 'analyst_query',
|
||||
arguments: {},
|
||||
},
|
||||
{
|
||||
type: 'action-result',
|
||||
callId: 'c1',
|
||||
name: 'analyst_query',
|
||||
result: shaped,
|
||||
},
|
||||
].reduce(reduceVoiceCard, initialVoiceCardState()),
|
||||
).result.notes;
|
||||
}
|
||||
|
||||
// Caveat = `${layerKey}: ${getEmptyNote(layerKey)}` (analystEngine.js:1026,
|
||||
// gevActions.js getEmptyNote → stats.coverage || stats.statusMessage).
|
||||
const cases = [
|
||||
['local-adsb', 'local-adsb: feeds 1090, 978 stale · 0 heard'],
|
||||
['local-adsb', 'local-adsb: feed 1090 stale · 0 heard'],
|
||||
['transit', 'transit: TTC 0 (95s old)'],
|
||||
['transit', 'transit: TTC 0 · GO Transit 0 (95s old)'],
|
||||
];
|
||||
|
||||
for (const locale of ['es', 'ru']) {
|
||||
for (const [layerKey, caveat] of cases) {
|
||||
test(`${locale}: analyst note "${caveat}" is translated`, () => {
|
||||
setLocale(locale);
|
||||
try {
|
||||
const notes = notesFor(layerKey, caveat);
|
||||
assert.ok(notes.length > 0, 'the note is shown');
|
||||
assert.doesNotMatch(notes.join(' | '), /\b(stale|heard|old)\b/);
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const [layerKey, caveat] of cases) {
|
||||
test(`en: analyst note "${caveat}" keeps its status line`, () => {
|
||||
setLocale('en');
|
||||
const line = caveat.slice(caveat.indexOf(': ') + 2);
|
||||
assert.ok(
|
||||
notesFor(layerKey, caveat).some((note) => note.endsWith(`: ${line}`)),
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user