mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
i18n: fix review findings and polish ru/es strings
Fixes the 51 P0–P2 findings from the full review of the i18n branch and the issues found while checking every new string on screen in ru and es. - Translate errors and statuses that still reached ru/es in English: feed and tile errors, provider statuses, the ALPR chip, the traffic mode chip, voice plan step labels, fire feed values, receiver bands, scene save reasons and the Cesium attribution link. - Show preset city names in the UI language (src/ui/placeNames.js); data and everything sent to the model stay English. - Share layer names between the layer panel, HUD and voice card (src/ui/layerNames.js). - Keep long ru/es strings whole: voice card error lines, analyst titles, the voice tier status, the Nepal evidence button, the ALPR retry chip. English layout is unchanged. - Ask before a language switch drops unsaved work. - Catalog fixes: glossary terms (пуск, пресет), gender agreement and consistent "peticiones" in es, fewer calques in both languages. - Fix English text that was itself wrong (e.g. "Exit cockpit to fly to a weather", raw tool ids in voice plan steps). Catalogs: es/ru 2535 messages each, complete. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8029747b7e
commit
00704ddc89
212 files changed
+9871
-909
No files matched your search
+52
-9
@@ -9,8 +9,8 @@ import {
|
||||
reduceTrafficSyncFeedback,
|
||||
} from '../loadingFeedback.js';
|
||||
import { setSplitFlapText, disposeSplitFlap } from '../splitFlap.js';
|
||||
import { t, msg } from '../i18n/index.js';
|
||||
import { localizeLayerName } from './layerPanel.js';
|
||||
import { getLocale, t, msg } from '../i18n/index.js';
|
||||
import { localizeLayerName, translateFeedError } from './layerPanel.js';
|
||||
|
||||
// loadingFeedback.js composes the shared status copy inside the portable
|
||||
// node/browser graph (the server-side HUD summary reads the same modules), so
|
||||
@@ -29,24 +29,66 @@ const STATUS_LABEL_KEYS = Object.freeze({
|
||||
'RETRYING ALPR CAMERAS': msg('RETRYING ALPR CAMERAS'),
|
||||
'FETCHING ALPR CAMERAS': msg('FETCHING ALPR CAMERAS'),
|
||||
'OVERPASS TEMPORARILY UNAVAILABLE': msg('OVERPASS TEMPORARILY UNAVAILABLE'),
|
||||
// The other mapped-site failure reasons (src/data/installationFeedback.js),
|
||||
// upper-cased by presentGlobalLoadingStatus.
|
||||
'OVERPASS RATE-LIMITED': msg('OVERPASS RATE-LIMITED'),
|
||||
'OVERPASS TIMED OUT': msg('OVERPASS TIMED OUT'),
|
||||
'OVERPASS COULD NOT COMPLETE THE QUERY': msg(
|
||||
'OVERPASS COULD NOT COMPLETE THE QUERY',
|
||||
),
|
||||
'MAP TILES TEMPORARILY UNAVAILABLE': msg('MAP TILES TEMPORARILY UNAVAILABLE'),
|
||||
'MAPPED NAMES TEMPORARILY UNAVAILABLE': msg(
|
||||
'MAPPED NAMES TEMPORARILY UNAVAILABLE',
|
||||
),
|
||||
'TURNING OFF LIVE DATA': msg('TURNING OFF LIVE DATA'),
|
||||
'REFRESHING LIVE DATA': msg('REFRESHING LIVE DATA'),
|
||||
'syncing road network': msg('syncing road network'),
|
||||
});
|
||||
|
||||
// The ALPR retry chip shows the layer's English error upper-cased
|
||||
// (loadingFeedback.js). These are the camera and vector tile failures it can
|
||||
// carry, by their upper-cased text; each is translated through its own
|
||||
// sentence-case key, the one the layer row shows, and upper-cased again.
|
||||
const CHIP_ERROR_KEYS = new Map(
|
||||
[
|
||||
msg('Vector tile metadata unavailable'),
|
||||
msg('Vector tiles unavailable'),
|
||||
msg('Vector tile request timed out'),
|
||||
msg('Camera coverage unavailable'),
|
||||
msg('Camera source temporarily unavailable'),
|
||||
].map((key) => [key.toUpperCase(), key]),
|
||||
);
|
||||
const CHIP_TILE_HTTP_RE = /^VECTOR TILES UNAVAILABLE \(HTTP (\d+)\)$/;
|
||||
|
||||
function localizeStatusLabel(label) {
|
||||
if (typeof label !== 'string' || !label) return label;
|
||||
const key = STATUS_LABEL_KEYS[label.trim()];
|
||||
return key ? t(key) : label;
|
||||
const text = label.trim();
|
||||
const key = STATUS_LABEL_KEYS[text];
|
||||
if (key) return t(key);
|
||||
const errorKey = CHIP_ERROR_KEYS.get(text);
|
||||
const http = errorKey ? null : CHIP_TILE_HTTP_RE.exec(text);
|
||||
if (!errorKey && !http) return label;
|
||||
return translateFeedError(
|
||||
errorKey || `Vector tiles unavailable (HTTP ${http[1]})`,
|
||||
).toLocaleUpperCase(getLocale());
|
||||
}
|
||||
|
||||
const RETRY_DETAIL_RE = /^(?:ALPR cameras · )?retrying in (\d+)s$/;
|
||||
// A retry detail is "retrying in Ns" or "retry pending", optionally prefixed
|
||||
// by the ALPR layer name (loadingFeedback.js). The prefix is kept in every
|
||||
// language: it is what tells the chip apart from a mapped-sites retry.
|
||||
const RETRY_DETAIL_RE =
|
||||
/^(?:(ALPR cameras) · )?(?:retrying in (\d+)s|(retry pending))$/;
|
||||
|
||||
function localizeStatusDetail(detail) {
|
||||
if (typeof detail !== 'string' || !detail) return detail;
|
||||
const match = detail.match(RETRY_DETAIL_RE);
|
||||
if (match) return t('retrying in {seconds}s', { seconds: match[1] });
|
||||
if (detail.trim() === 'retry pending') return t('retry pending');
|
||||
const match = detail.trim().match(RETRY_DETAIL_RE);
|
||||
if (match) {
|
||||
const [, prefix, seconds, pending] = match;
|
||||
const retry = pending
|
||||
? t('retry pending')
|
||||
: t('retrying in {seconds}s', { seconds });
|
||||
return prefix ? `${t('ALPR cameras')} · ${retry}` : retry;
|
||||
}
|
||||
return localizeLayerRoster(detail);
|
||||
}
|
||||
|
||||
@@ -64,7 +106,8 @@ function localizeLayerRoster(detail) {
|
||||
);
|
||||
}
|
||||
|
||||
function localizeLoadingPresentation(presentation) {
|
||||
/** The chip's label and detail in the UI language (exported for tests). */
|
||||
export function localizeLoadingPresentation(presentation) {
|
||||
if (!presentation) return presentation;
|
||||
return {
|
||||
...presentation,
|
||||
|
||||
Reference in new issue
Block a user