A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.
JavaScript 3d-globecesiumflight-trackinggeospatialgeospatial-intelligencegisosintphotogrammetrysatellite-trackingspatial-intelligencewebglworldview
fix(voice): keep FIRMS and ALPR entity labels English in voice data
daikaginzacec5d99e13e1
diff --git a/src/data/alprCameras.test.mjs b/src/data/alprCameras.test.mjsindex 5a50220d5..71ee6d675 100644--- a/src/data/alprCameras.test.mjs+++ b/src/data/alprCameras.test.mjs@@ -9,6 +9,7 @@ import alprCamerasLayer, {} from './alprCameras.js';import { createAlprTileSource } from '../layers/alpr/source.js';import { DATA_CREDITS } from './dataCredits.js';+import { setLocale } from '../i18n/index.js';import {clearSelectedEntityContextForLayer,getContextStore,@@ -473,6 +474,25 @@ 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 {+ h.setFetch(async () =>+ cameraResponse([+ cameraNode(42, { tags: { 'surveillance:type': 'ALPR' } }),+ ]),+ );+ await alprCamerasLayer.update();+ h.click(h.source.entities.values[0].id);+ assert.equal(getSelectedEntityContext().label, 'ALPR camera');+ } finally {+ setLocale('en');+ h.restore();+ }+});+test('invalid OSM ids and out-of-range coordinates never become camera entities', () => {for (const id of [undefined, null, 0, -1, 1.5, '42', NaN])assert.equal(normalizeAlprNode(cameraNode(id, { id })), null);diff --git a/src/data/firmsInteraction.test.mjs b/src/data/firmsInteraction.test.mjsindex 442af60b2..cde867f87 100644--- a/src/data/firmsInteraction.test.mjs+++ b/src/data/firmsInteraction.test.mjs@@ -8,6 +8,8 @@ import * as Cesium from 'cesium';import { createFirmsHeatmapLayer, applyFirmsOverlayPolicy, buildCellCard } from './firmsHeatmap.js';import { fireDetectionKey } from './firmsLabels.js';import { registerPickOwner, unregisterPickOwner } from './pickRegistry.js';+import { getSelectedEntityContext } from './contextStore.js';+import { setLocale } from '../i18n/index.js';import { WORLD_FOCUS_REQUEST_EVENT } from '../worldFocus.js';import { readLayerSource } from '../testSupport/readLayerSource.mjs';import path from 'node:path';@@ -234,6 +236,22 @@ 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 {+ h.click();+ assert.equal(getSelectedEntityContext().label, 'Fire · FRP 1520 MW');+ assert.equal(h.layer.getSelectedInfo().label, 'Fire · FRP 1520 MW');+ assert.equal(h.layer.getStrongestFire().label, 'Fire · FRP 1520 MW');+ } finally {+ h.cleanup();+ setLocale('en');+ }+});+test('a click on neither sprite nor card clears without moving the camera', () => {const h = harness({ picked: { primitive: {}, content: {}, featureId: 0 } });try {diff --git a/src/layers/alpr/presentation.js b/src/layers/alpr/presentation.jsindex 866f15a6d..c7343d573 100644--- a/src/layers/alpr/presentation.js+++ b/src/layers/alpr/presentation.js@@ -13,7 +13,7 @@ import {MARKER_SCALE_BY_DISTANCE,} from './policy.js';import { boxContains } from './model.js';-import { t } from '../../i18n/index.js';+import { msg } from '../../i18n/index.js';import { createAlprFloorResolver } from './floors.js';import { createAlprOverlay } from './overlay.js';import {@@ -452,7 +452,7 @@ export function createAlprPresentation({ state, services, source }) {layerName: 'ALPR Cameras',source:source.attribution?.description || source.label || 'Camera source',- label: t('ALPR camera'),+ label: msg('ALPR camera'),latitude: record.latitude,longitude: record.longitude,properties: {diff --git a/src/layers/firms/queries.js b/src/layers/firms/queries.jsindex a7d22589e..16ca01166 100644--- a/src/layers/firms/queries.js+++ b/src/layers/firms/queries.js@@ -18,9 +18,8 @@ export function createQueries({if (!fire) return null;return {id: fireDetectionKey(fire),- label: t('Fire · FRP {frp} MW', {- frp: components.model.formatFrp(fire.frp),- }),+ // i18n-ignore: English entity label; the voice card translates it (shownEntityLabel)+ label: `Fire · FRP ${components.model.formatFrp(fire.frp)} MW`,latitude: fire.lat,longitude: fire.lon,frp: fire.frp,@@ -117,9 +116,8 @@ export function createQueries({latitude: strongest.lat,longitude: strongest.lon,frp: strongest.frp,- label: t('Fire · FRP {frp} MW', {- frp: components.model.formatFrp(strongest.frp),- }),+ // i18n-ignore: English entity label; the voice card translates it (shownEntityLabel)+ label: `Fire · FRP ${components.model.formatFrp(strongest.frp)} MW`,};},diff --git a/src/layers/firms/selection.js b/src/layers/firms/selection.jsindex fc05eea2a..d5cfc4d26 100644--- a/src/layers/firms/selection.js+++ b/src/layers/firms/selection.js@@ -193,9 +193,8 @@ export function createSelection({layerName: name,source: 'NASA FIRMS',dataSource: layerState._dataSource,- label: t('Fire · FRP {frp} MW', {- frp: components.model.formatFrp(fire.frp),- }),+ // i18n-ignore: English entity label; the voice card translates it (shownEntityLabel)+ label: `Fire · FRP ${components.model.formatFrp(fire.frp)} MW`,latitude: fire.lat,longitude: fire.lon,properties: {