mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 11:24:00 +00:00
i18n: wrap the ru/es push-to-talk hint; show city names in voice results
- The help tray over the mic clipped the longer ru/es hint ("Hold Space
to speak · tap Space to activate focused controls"); let it wrap in
non-English locales. English layout is unchanged.
- The fly-to headline and the nearest-aircraft distance line now show a
preset city in the interface language (Tokyo → Токио / Tokio); speech
sent to the model stays English.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
54f7513ef6
commit
df639a5a06
3 files changed
+59
-2
No files matched your search
@@ -0,0 +1,48 @@
|
||||
// The voice card names a preset city in the interface language in the
|
||||
// fly-to headline and the nearest-aircraft distance line; what the model
|
||||
// says stays English.
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { setLocale } from '../i18n/index.js';
|
||||
import { SPEECH_BUILDERS } from './speech.js';
|
||||
|
||||
function inLocale(locale, run) {
|
||||
setLocale(locale);
|
||||
try {
|
||||
return run();
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
}
|
||||
|
||||
const FLY = { ok: true, arrived: true, label: 'Tokyo' };
|
||||
const NEAREST = {
|
||||
ok: true,
|
||||
layerId: 'flights',
|
||||
location: { label: 'Tokyo' },
|
||||
aircraft: { callsign: 'JAL123', distanceKm: 12, altitudeM: 3000 },
|
||||
feed: {},
|
||||
};
|
||||
|
||||
test('the fly-to headline shows the city in the interface language', () => {
|
||||
assert.equal(SPEECH_BUILDERS.fly_to_location(FLY).display.title, 'Tokyo');
|
||||
const ru = inLocale('ru', () => SPEECH_BUILDERS.fly_to_location(FLY));
|
||||
assert.equal(ru.display.title, 'Токио');
|
||||
assert.match(ru.say, /Tokyo/);
|
||||
const es = inLocale('es', () => SPEECH_BUILDERS.fly_to_location(FLY));
|
||||
assert.equal(es.display.title, 'Tokio');
|
||||
});
|
||||
|
||||
test('the nearest-aircraft distance line shows the city in the interface language', () => {
|
||||
const en = SPEECH_BUILDERS.select_nearest_aircraft(NEAREST);
|
||||
assert.match(en.display.lines[0], /from Tokyo$/);
|
||||
const ru = inLocale('ru', () =>
|
||||
SPEECH_BUILDERS.select_nearest_aircraft(NEAREST),
|
||||
);
|
||||
assert.match(ru.display.lines[0], /Токио/);
|
||||
assert.match(ru.say, /Tokyo/);
|
||||
const es = inLocale('es', () =>
|
||||
SPEECH_BUILDERS.select_nearest_aircraft(NEAREST),
|
||||
);
|
||||
assert.match(es.display.lines[0], /Tokio/);
|
||||
});
|
||||
Reference in new issue
Block a user