Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

test(i18n): feed real FIRMS and ALPR labels through the voice card

daikaginza843c8b1a6bba
diff --git a/src/data/alprCameras.test.mjs b/src/data/alprCameras.test.mjs
index 71ee6d675..549adde96 100644
--- a/src/data/alprCameras.test.mjs
+++ b/src/data/alprCameras.test.mjs
@@ -10,6 +10,7 @@ import alprCamerasLayer, {
import { createAlprTileSource } from '../layers/alpr/source.js';
import { DATA_CREDITS } from './dataCredits.js';
import { setLocale } from '../i18n/index.js';
+import { shownEntityLabel } from '../voice/speech.js';
import {
clearSelectedEntityContextForLayer,
getContextStore,
@@ -477,8 +478,8 @@ test('all manufacturers share one ALPR title and color; only supplied metadata a
// The voice model reads the label as data; the voice card translates it.
test('the camera label stays English data in a translated interface', async () => {
const h = cameraHarness();
- setLocale('ru');
try {
+ setLocale('ru');
h.setFetch(async () =>
cameraResponse([
cameraNode(42, { tags: { 'surveillance:type': 'ALPR' } }),
@@ -487,6 +488,10 @@ test('the camera label stays English data in a translated interface', async () =
await alprCamerasLayer.update();
h.click(h.source.entities.values[0].id);
assert.equal(getSelectedEntityContext().label, 'ALPR camera');
+ assert.equal(
+ shownEntityLabel(getSelectedEntityContext().label),
+ 'Камера ALPR',
+ );
} finally {
setLocale('en');
h.restore();
diff --git a/src/data/firmsInteraction.test.mjs b/src/data/firmsInteraction.test.mjs
index cde867f87..d735df3f8 100644
--- a/src/data/firmsInteraction.test.mjs
+++ b/src/data/firmsInteraction.test.mjs
@@ -10,6 +10,7 @@ import { fireDetectionKey } from './firmsLabels.js';
import { registerPickOwner, unregisterPickOwner } from './pickRegistry.js';
import { getSelectedEntityContext } from './contextStore.js';
import { setLocale } from '../i18n/index.js';
+import { shownEntityLabel } from '../voice/speech.js';
import { WORLD_FOCUS_REQUEST_EVENT } from '../worldFocus.js';
import { readLayerSource } from '../testSupport/readLayerSource.mjs';
import path from 'node:path';
@@ -239,11 +240,16 @@ test('clicking a fire CARD behaves exactly like clicking its sprite', () => {
// The voice model reads these labels as data (track_entity, get_entity_context,
// pointer_context); the voice card translates them where it shows them.
test('fire labels stay English data in a translated interface', () => {
- setLocale('ru');
const h = harness({ fires: [makeFire()], picked: { id: 'firms-7' } });
try {
+ setLocale('ru');
h.click();
assert.equal(getSelectedEntityContext().label, 'Fire · FRP 1520 MW');
+ // The card's pattern must match what the producer actually writes.
+ assert.equal(
+ shownEntityLabel(getSelectedEntityContext().label),
+ 'Пожар · FRP 1520 МВт',
+ );
assert.equal(h.layer.getSelectedInfo().label, 'Fire · FRP 1520 MW');
assert.equal(h.layer.getStrongestFire().label, 'Fire · FRP 1520 MW');
} finally {