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:
German KhokhlovandClaude Opus 5.5 committed 2026-10-15 23:49:52 +04:00
1 parent 8029747b7e
commit 00704ddc89
212 files changed
+9871 -909

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
/**
* The reason shown in «Scene not saved — {reason}» when the project fails its
* own validation on save.
*
* A SceneDocumentError names a JSON path and an English check
* («$.scenes[6].title: expected nonempty text, at most 4096 characters») —
* right for the console and for import diagnostics, meaningless in a toast.
* The failures an author can cause from the panel get a plain sentence with
* 1-based scene and shot numbers. Anything else keeps the technical text in
* English and gets a general sentence in a translation; director.js logs the
* error either way.
*/
import { formatNumber, getLocale, t } from '../i18n/index.js';
const TEXT_LIMIT = /^expected nonempty text, at most (\d+) characters$/;
const SCENE_TITLE = /^\$\.scenes\[(\d+)\]\.title$/;
const SHOT_TITLE = /^\$\.scenes\[(\d+)\]\.shots\[(\d+)\]\.title$/;
const ordinal = (index) => formatNumber(Number(index) + 1);
/**
* @param {unknown} error Usually a SceneDocumentError ({path, reason}).
* @returns {string} Reason in the UI language.
*/
export function sceneSaveFailureReason(error) {
const path = typeof error?.path === 'string' ? error.path : '';
const reason =
typeof error?.reason === 'string'
? error.reason
: String(error?.message || '').slice(path ? path.length + 2 : 0);
const limit = TEXT_LIMIT.exec(reason);
if (limit) {
const max = formatNumber(Number(limit[1]));
const scene = SCENE_TITLE.exec(path);
if (scene)
return t(
'the title of scene {scene} is empty or longer than {max} characters',
{ scene: ordinal(scene[1]), max },
);
const shot = SHOT_TITLE.exec(path);
if (shot)
return t(
'the title of shot {shot} in scene {scene} is empty or longer than {max} characters',
{ scene: ordinal(shot[1]), shot: ordinal(shot[2]), max },
);
}
if (path === '$' && reason === 'file exceeds 5 MiB')
return t('the project is larger than 5 MiB');
if (reason === 'too many shots in project')
return t('the project has too many shots');
// English keeps the validator's own text, which names the field; another
// language gets a general sentence (the field is in the console warning).
if (getLocale() === 'en' && error?.message) return String(error.message);
return t('the scene data failed validation');
}