fix(analyst): keep the Mapped Installations empty note English

getStats().statusMessage was translated inside the layer, and the
analyst uses it as the empty note it returns to the model, so an empty
military-installations query carried Spanish or Russian text in an
English tool result. Report installationFeedback() as English again;
the displays translate it by its shape.
This commit is contained in:
daikaginza committed 2026-10-17 07:28:26 +07:00
1 parent dddd1fa03f
commit 4515c5146a
3 files changed
+116 -90

No files matched your search

+9 -35
View File
@@ -1,37 +1,11 @@
import * as Cesium from 'cesium';
import { describeInstallationFeedback } from '../../data/installationFeedback.js';
import { installationFeedback } from '../../data/installationFeedback.js';
import {
LAYER_ID,
DISTANCE_PREFILTER_MARGIN_M,
ANCHOR_REFRESH_M,
} from './policy.js';
import { formatNumber, t, tn } from '../../i18n/index.js';
// installationFeedback.js is shared with the HUD (src/loadingFeedback.js) and
// hands back msg()-marked English plus values; getStats translates them here.
function localizeInstallationFeedback(feedback) {
if (feedback.text !== undefined) {
const values = {};
if (feedback.reason !== undefined) values.reason = t(feedback.reason);
if (feedback.seconds !== undefined) values.seconds = feedback.seconds;
return t(feedback.text, values);
}
const { count, km } = feedback;
if (km) {
const kmText = formatNumber(km);
return count === 0
? t('No mapped sites within {km} km of the contact', { km: kmText })
: tn(
count,
'{count} mapped site within {km} km of the contact',
'{count} mapped sites within {km} km of the contact',
{ km: kmText },
);
}
return count === 0
? t('No mapped sites in view')
: tn(count, '{count} mapped site in view', '{count} mapped sites in view');
}
import { t } from '../../i18n/index.js';
export function createControls({ state: layerState, services, parts, source }) {
const methods = {
@@ -252,13 +226,13 @@ export function createControls({ state: layerState, services, parts, source }) {
retryAt: layerState.retryAt,
retrying: layerState.loading && Boolean(layerState.failureReason),
failureReason: layerState.failureReason,
statusMessage: localizeInstallationFeedback(
describeInstallationFeedback({
...layerState,
count: layerState.lastUpdate ? mappedCount : undefined,
retrying: layerState.loading && Boolean(layerState.failureReason),
}),
),
// English data: it is also the analyst's empty note to the model.
// Displays translate it by its shape (ui/statusText.js).
statusMessage: installationFeedback({
...layerState,
count: layerState.lastUpdate ? mappedCount : undefined,
retrying: layerState.loading && Boolean(layerState.failureReason),
}),
loadingLabel: layerState.loading
? t('loading mapped installation context')
: '',