mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
A review of the Russian UI screenshots found ~90 places where longer words
broke the layout or text was still English. Fixed so they hold for any
language, then shortened where a control is short by design.
- Layout: label columns that size to their text (weather and wind settings,
Recent Imagery slots and opacity, style sliders, display panel), layer
list names and icons, buttons that wrap instead of overflowing (CCTV,
scenes, Bhote Koshi), voice header that always shows the cost, styled
EN | ES | RU chips, voice error tray above the dock.
- t() context: t('CLEAR', { context: 'action' }) is «СБРОСИТЬ» while the sky
stays «ЯСНО»; also used for radio categories, voice states and directions.
- Units and dates follow the locale through src/ui/unitLabels.js
(formatQuantity: localized number, translated unit, non-breaking space):
wind, pressure, cyclones, directions, CCTV, SDR gain, scene timing, flight
tooltip, Recent Imagery dates and resolution.
- Newly translated: directions turn-by-turn steps (built from the maneuver;
English matches the server word for word), HUD mode and summary, voice
card states, radio categories on the globe, CCTV status, layer source
lines, scene dialogs (Cancel, file pickers), Bhote Koshi statuses, titles,
comparison dates and caveat, Recent Imagery notices. Stored data and text
for AI tools stay English.
- es and ru: 1,885 messages each.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
170 lines
5.1 KiB
JavaScript
170 lines
5.1 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
internetRadioAudioActive,
|
|
localSdrCardView,
|
|
localSdrFeedLine,
|
|
localSdrFmAudioActive,
|
|
localSdrGainOptionLabel,
|
|
} from './localSdrPresentation.js';
|
|
import { setLocale } from '../i18n/index.js';
|
|
|
|
const idle = Object.freeze({
|
|
webUsbSupported: true,
|
|
connected: false,
|
|
status: 'idle',
|
|
message: 'Connect an RTL-SDR to begin.',
|
|
mode: 'fm',
|
|
frequencyHz: 98_500_000,
|
|
volume: 0.8,
|
|
gain: 'auto',
|
|
seeking: false,
|
|
seekMessage: '',
|
|
decodedMessages: 0,
|
|
messagesPerSecond: null,
|
|
aircraftHeard: 0,
|
|
aircraftPositioned: 0,
|
|
deviceLabel: null,
|
|
locationStatus: 'unknown',
|
|
audioState: 'idle',
|
|
samplesPerSecond: 0,
|
|
workerBlocks: 0,
|
|
iqLevelDbfs: null,
|
|
audioLevelDbfs: null,
|
|
});
|
|
|
|
test('an idle card invites a connection and hides receiver stats', () => {
|
|
const view = localSdrCardView(idle);
|
|
assert.equal(view.statusText, 'Connect an RTL-SDR to begin.');
|
|
assert.equal(view.connectLabel, 'CONNECT');
|
|
assert.equal(view.connectDisabled, false);
|
|
assert.equal(view.connectionLabel, 'IDLE');
|
|
assert.equal(view.gainValue, 'auto');
|
|
assert.equal(view.statsHidden, true);
|
|
assert.equal(view.tuneDisabled, true);
|
|
assert.equal(view.seekDisabled, true);
|
|
assert.equal(view.frequencyValue, '98.5');
|
|
const unsupported = localSdrCardView({
|
|
...idle,
|
|
webUsbSupported: false,
|
|
status: 'unsupported',
|
|
message: 'WebUSB is unavailable in this browser',
|
|
});
|
|
assert.equal(unsupported.connectDisabled, true);
|
|
assert.equal(unsupported.changeDeviceDisabled, true);
|
|
assert.equal(unsupported.statusError, true);
|
|
});
|
|
|
|
test('streaming ADS-B shows message rate, heard, positioned and IQ level', () => {
|
|
const view = localSdrCardView({
|
|
...idle,
|
|
connected: true,
|
|
status: 'streaming',
|
|
mode: 'adsb',
|
|
message: 'Receiving 1090 MHz ADS-B',
|
|
gain: 20.7,
|
|
messagesPerSecond: 13.8,
|
|
aircraftHeard: 4,
|
|
aircraftPositioned: 2,
|
|
iqLevelDbfs: -21.44,
|
|
samplesPerSecond: 2_000_000,
|
|
decodedMessages: 276,
|
|
deviceLabel: 'FlyCatcher_ADS_B',
|
|
});
|
|
assert.equal(view.statsHidden, false);
|
|
assert.deepEqual(view.stats, {
|
|
rate: '13.8',
|
|
heard: '4',
|
|
positioned: '2',
|
|
iq: '-21.4 dBFS',
|
|
});
|
|
assert.equal(view.gainValue, '20.7');
|
|
assert.equal(view.connectionLabel, '4 HEARD');
|
|
assert.equal(view.connectLabel, 'DISCONNECT');
|
|
assert.equal(view.frequencyDisabled, true);
|
|
assert.equal(view.volumeDisabled, true);
|
|
assert.equal(
|
|
view.statusText,
|
|
'Receiving 1090 MHz ADS-B · FlyCatcher_ADS_B · 2.00 MS/s IQ · 276 messages',
|
|
);
|
|
});
|
|
|
|
test('local FM and internet radio audio states drive the one-listener rule', () => {
|
|
assert.equal(localSdrFmAudioActive(idle), false);
|
|
assert.equal(
|
|
localSdrFmAudioActive({ ...idle, connected: true, status: 'streaming' }),
|
|
true,
|
|
);
|
|
assert.equal(
|
|
localSdrFmAudioActive({
|
|
...idle,
|
|
connected: true,
|
|
status: 'streaming',
|
|
mode: 'adsb',
|
|
}),
|
|
false,
|
|
'ADS-B produces no audio',
|
|
);
|
|
for (const audioState of ['loading', 'buffering', 'playing'])
|
|
assert.equal(internetRadioAudioActive({ audioState }), true);
|
|
assert.equal(internetRadioAudioActive({ audioState: 'paused' }), false);
|
|
assert.equal(internetRadioAudioActive(null), false);
|
|
});
|
|
|
|
test('the decoder-feed line appears only when feeds are configured', () => {
|
|
assert.equal(localSdrFeedLine(null), null);
|
|
assert.equal(
|
|
localSdrFeedLine({ configured: false, feeds: [], polling: false }),
|
|
null,
|
|
);
|
|
const feeds = [
|
|
{ band: '1090', label: '1090 MHz', status: 'live' },
|
|
{ band: '978', label: '978 MHz UAT', status: 'unreachable' },
|
|
];
|
|
assert.equal(
|
|
localSdrFeedLine({ configured: true, polling: true, feeds }),
|
|
'Decoder feeds: 1090 live · 978 unreachable',
|
|
);
|
|
assert.equal(
|
|
localSdrFeedLine({ configured: true, polling: false, feeds }),
|
|
'Decoder feeds: 1090 · 978 · read while Local ADS-B is on',
|
|
);
|
|
assert.equal(
|
|
localSdrFeedLine({
|
|
configured: true,
|
|
polling: false,
|
|
feeds: [{ band: null, label: 'entry 2', status: 'invalid' }],
|
|
}),
|
|
'Decoder feeds: entry 2 invalid · read while Local ADS-B is on',
|
|
);
|
|
});
|
|
|
|
test('two feeds on one band are told apart by their ordinal labels', () => {
|
|
const feeds = [
|
|
{ band: '1090', label: '1090 MHz', status: 'live' },
|
|
{ band: '978', label: '978 MHz UAT #1', status: 'live' },
|
|
{ band: '978', label: '978 MHz UAT #2', status: 'stale' },
|
|
];
|
|
assert.equal(
|
|
localSdrFeedLine({ configured: true, polling: true, feeds }),
|
|
'Decoder feeds: 1090 live · 978 MHz UAT #1 live · 978 MHz UAT #2 stale',
|
|
);
|
|
assert.equal(
|
|
localSdrFeedLine({ configured: true, polling: false, feeds }),
|
|
'Decoder feeds: 1090 · 978 MHz UAT #1 · 978 MHz UAT #2 · read while Local ADS-B is on',
|
|
);
|
|
});
|
|
|
|
test('gain option labels follow the page language; values stay numeric', () => {
|
|
try {
|
|
setLocale('en');
|
|
assert.equal(localSdrGainOptionLabel('28.0'), '28.0\u00a0dB');
|
|
assert.equal(localSdrGainOptionLabel('0.9'), '0.9\u00a0dB');
|
|
setLocale('ru');
|
|
assert.match(localSdrGainOptionLabel('28.0'), /^28,0\u00a0\S+$/);
|
|
} finally {
|
|
setLocale('en');
|
|
}
|
|
});
|