diff --git a/src/data/installationFeedback.js b/src/data/installationFeedback.js index cfc1ae6199..7209ded520 100644 --- a/src/data/installationFeedback.js +++ b/src/data/installationFeedback.js @@ -20,7 +20,7 @@ const FALLBACK_REASON = msg('Overpass temporarily unavailable'); * @param {number} [now] * @returns {{text: string, reason?: string, seconds?: number}|{count: number, km: ?number}} */ -export function describeInstallationFeedback(stats = {}, now = Date.now()) { +function describeInstallationFeedback(stats = {}, now = Date.now()) { const reason = REASONS[stats.failureReason] || FALLBACK_REASON; if (stats.loading) return { diff --git a/src/layers/awareness/panel.js b/src/layers/awareness/panel.js index bf14e86b2e..33f206e225 100644 --- a/src/layers/awareness/panel.js +++ b/src/layers/awareness/panel.js @@ -2,14 +2,9 @@ import { formatAwarenessLabel, AWARENESS_RADIUS_M, } from '../../data/militaryAwarenessEngine.js'; -import { - formatNumber, - onLocaleChange, - t, - translateKnown, -} from '../../i18n/index.js'; +import { formatNumber, onLocaleChange, t } from '../../i18n/index.js'; import { sourceStatusLabel } from '../../ui/layerNames.js'; -import { translateStatusPiece } from '../../ui/statusText.js'; +import { translateStatusMessage } from '../../ui/statusText.js'; import { formatQuantity } from '../../ui/unitLabels.js'; import { AWARENESS_PAGE_SIZE, AWARENESS_PAGE_ROTATE_MS } from './policy.js'; import { distanceParts } from '../../data/distanceFormat.js'; @@ -46,7 +41,7 @@ export function presentAwarenessDistance(meters) { function presentAwarenessReason(summary = {}) { return summary.reasonTemplate ? t(summary.reasonTemplate, summary.reasonValues) - : translateStatusPiece(summary.reason || ''); + : translateStatusMessage(summary.reason || ''); } /** diff --git a/src/layers/installations/installationFeedbackLocale.test.mjs b/src/layers/installations/installationFeedbackLocale.test.mjs index 0591a74eee..c74c0ee477 100644 --- a/src/layers/installations/installationFeedbackLocale.test.mjs +++ b/src/layers/installations/installationFeedbackLocale.test.mjs @@ -1,8 +1,8 @@ // statusMessage stays English (the analyst's empty note); displays translate it. import test from 'node:test'; import assert from 'node:assert/strict'; -import { setLocale, t, tn, translateKnown } from '../../i18n/index.js'; -import { translateStatusPiece } from '../../ui/statusText.js'; +import { setLocale, t, tn } from '../../i18n/index.js'; +import { translateStatusMessage } from '../../ui/statusText.js'; import { createControls } from './controls.js'; function stats(state) { @@ -110,16 +110,10 @@ for (const locale of ['es', 'ru']) { test(`${locale}: installation statusMessage is shown in the UI language`, () => { inLocale(locale, () => { for (const [state, english, shown] of cases) { - const shownText = translateStatusPiece(stats(state).statusMessage); + const shownText = translateStatusMessage(stats(state).statusMessage); assert.notEqual(shownText, english); assert.equal(shownText, shown()); } - for (const text of [ - 'Too many mapped sites in view to list them all', - 'Installation context unavailable', - ]) { - assert.notEqual(translateKnown(text), text); - } }); }); } @@ -128,6 +122,6 @@ test('en: installation feedback keeps its English wording', () => { setLocale('en'); for (const [state, english] of cases) { assert.equal(stats(state).statusMessage, english); - assert.equal(translateStatusPiece(english), english); + assert.equal(translateStatusMessage(english), english); } }); diff --git a/src/ui/contextBindings.js b/src/ui/contextBindings.js index e786a8e3c6..c4e3a46155 100644 --- a/src/ui/contextBindings.js +++ b/src/ui/contextBindings.js @@ -1,6 +1,6 @@ import { t } from '../i18n/index.js'; import { spaceMissionsIndexFailure } from './contextActions.js'; -import { translateStatusPiece } from './statusText.js'; +import { translateStatusMessage } from './statusText.js'; import { shouldExpandGlobalContextPanel } from '../rightRailPolicy.js'; export function _initGlobalContextPanel() { @@ -113,7 +113,7 @@ export function _initGlobalContextPanel() { if (this.destroyed || searched === false) return false; const stats = this.installations.getStats?.(); this.showToast( - (stats?.statusMessage && translateStatusPiece(stats.statusMessage)) || + (stats?.statusMessage && translateStatusMessage(stats.statusMessage)) || (stats?.status === 'zoom-in' ? t('Zoom in to search mapped installations') : t('Nearby installations refreshed')), diff --git a/src/ui/statusText.js b/src/ui/statusText.js index 8d43ccfbc1..7d1c5cf988 100644 --- a/src/ui/statusText.js +++ b/src/ui/statusText.js @@ -300,7 +300,7 @@ function statusPatternText(piece) { } /** One piece of a status line in the UI language, or as it came. */ -export function translateStatusPiece(piece) { +function translateStatusPiece(piece) { const known = translateKnown(piece); if (known !== piece) return known; return statusPatternText(piece) ?? piece;