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

+143
View File
@@ -0,0 +1,143 @@
// Display helpers must not rewrite operator-typed scene/shot titles: only the
// generated "Scene N" / "Shot N" and the titles of recipe-sourced shots
// localize; everything else shows exactly as stored.
import test from 'node:test';
import assert from 'node:assert/strict';
import {
SCENE_RECIPES,
displaySceneTitle,
displayShotTitle,
} from './recipes.js';
import { setLocale } from '../i18n/index.js';
test.afterEach(() => setLocale('en'));
test('user-typed numbered titles keep their digits in en', () => {
setLocale('en');
assert.equal(
displaySceneTitle({ id: 'scene-user', title: 'Scene 007' }),
'Scene 007',
);
assert.equal(displayShotTitle('Shot 01'), 'Shot 01');
// default generated names still work
assert.equal(
displaySceneTitle({ id: 'scene-user', title: 'Scene 3' }),
'Scene 3',
);
assert.equal(displayShotTitle('Shot 2'), 'Shot 2');
});
test('generated numbered titles localize, typed ones with leading zeros do not', () => {
setLocale('ru');
assert.equal(
displaySceneTitle({ id: 'scene-user', title: 'Scene 3' }),
'Сцена 3',
);
assert.equal(displayShotTitle('Shot 2'), 'Кадр 2');
assert.equal(
displaySceneTitle({ id: 'scene-user', title: 'Scene 007' }),
'Scene 007',
);
assert.equal(displayShotTitle('Shot 01'), 'Shot 01');
});
test('a built-in shot title localizes only for a recipe-sourced shot', () => {
setLocale('ru');
// A built-in shot title (BUILTIN_SHOT_TITLES in recipes.js).
const title = 'Final view';
const userScene = { id: 'scene-user' };
// Operator-typed title that happens to match a built-in one: shown as typed.
assert.equal(
displayShotTitle(title, { id: 'shot-user', title }, userScene),
title,
);
// A recipe-sourced shot: localized.
const fromRecipe = displayShotTitle(
title,
{ id: 'shot-recipe', title, sourcePackId: 'bhote-koshi-nepal-scene' },
userScene,
);
assert.notEqual(fromRecipe, title);
// Without provenance the title alone decides, as before.
assert.equal(displayShotTitle(title), fromRecipe);
// A project saved before shots recorded their source pack: the scene's
// recipe still vouches for a title its keyframes declare (only when such a
// recipe ships in this build).
const named = (keyframe) =>
keyframe?.title && !/^Shot \d+$/.test(keyframe.title);
const recipe = SCENE_RECIPES.find((item) => item.cameraPath?.some(named));
if (recipe) {
const declared = recipe.cameraPath.find(named).title;
assert.equal(
displayShotTitle(
declared,
{ id: 'shot-old', title: declared },
{ id: recipe.id },
),
displayShotTitle(declared),
);
assert.equal(
displayShotTitle(
declared,
{ id: 'shot-old', title: declared },
userScene,
),
declared,
);
}
});
test('the Scene status line shows an operator-typed shot title as typed', async () => {
const { createScenePlaybackAdapter } = await import('./playbackAdapter.js');
const statuses = [];
const director = {
_renderSceneSelect() {},
_renderShotList() {},
_updateStatus: (text) => statuses.push(text),
_logEvent() {},
};
const adapter = createScenePlaybackAdapter(director, 4);
const title = 'Final view';
const scene = { id: 'scene-user', title: 'Scene 1', shots: [] };
setLocale('ru');
adapter.selectShot({
scene,
shot: { id: 'shot-user', title },
index: 0,
total: 1,
});
adapter.selectShot({
scene,
shot: { id: 'shot-recipe', title, sourcePackId: 'bhote-koshi-nepal-scene' },
index: 0,
total: 1,
});
assert.ok(statuses[0].endsWith(` / ${title}`), statuses[0]);
assert.ok(
statuses[1].endsWith(` / ${displayShotTitle(title)}`) &&
!statuses[1].endsWith(` / ${title}`),
statuses[1],
);
});
test('the scene context of a shot carries its display title by provenance', async () => {
const { layerStatesForShot } = await import('./shotPresentation.js');
const title = 'Final view';
const packs = { recipeForShot: () => null, minimumHoldSec: () => 0 };
const contextFor = (shot) => {
const scene = { id: 'scene-user', title: 'Scene 1', shots: [shot] };
const states = layerStatesForShot(
scene,
{ ...shot, layers: { a: { params: { presentation: 'scene-beat' } } } },
packs,
);
return states.a.params.sceneContext;
};
setLocale('ru');
assert.equal(contextFor({ id: 'u', title }).shotDisplayTitle, title);
assert.notEqual(
contextFor({ id: 'r', title, sourcePackId: 'bhote-koshi-nepal-scene' })
.shotDisplayTitle,
title,
);
});