mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +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
@@ -0,0 +1,102 @@
|
||||
// Proposal 8: «Scene not saved — {reason}» showed the validator's JSON path
|
||||
// and English check. Known failures read as a sentence; the rest get a
|
||||
// general reason (the technical text is logged by director.js).
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
import { setLocale } from '../i18n/index.js';
|
||||
import {
|
||||
SceneDocumentError,
|
||||
validateSceneDocument,
|
||||
} from '../director/document.js';
|
||||
import { sceneSaveFailureReason } from './sceneSaveError.js';
|
||||
|
||||
const caught = (project) => {
|
||||
try {
|
||||
validateSceneDocument(project);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
return assert.fail('expected a validation error');
|
||||
};
|
||||
|
||||
test('an empty scene title is named with its 1-based scene number', () => {
|
||||
setLocale('en');
|
||||
const scenes = Array.from({ length: 7 }, (_, i) => ({
|
||||
id: `s${i}`,
|
||||
title: i === 6 ? ' ' : `Scene ${i + 1}`,
|
||||
shots: [],
|
||||
}));
|
||||
const error = caught({ version: 6, scenes });
|
||||
assert.ok(error instanceof SceneDocumentError);
|
||||
assert.equal(error.path, '$.scenes[6].title');
|
||||
assert.equal(
|
||||
sceneSaveFailureReason(error),
|
||||
'the title of scene 7 is empty or longer than 4,096 characters',
|
||||
);
|
||||
});
|
||||
|
||||
test('a shot title names the shot and its scene', () => {
|
||||
setLocale('en');
|
||||
const error = caught({
|
||||
version: 6,
|
||||
scenes: [
|
||||
{
|
||||
id: 'a',
|
||||
title: 'A',
|
||||
shots: [{ id: 'x' }, { id: 'y', title: 'z'.repeat(4097) }],
|
||||
},
|
||||
],
|
||||
});
|
||||
assert.equal(
|
||||
sceneSaveFailureReason(error),
|
||||
'the title of shot 2 in scene 1 is empty or longer than 4,096 characters',
|
||||
);
|
||||
});
|
||||
|
||||
test('size and shot-count limits read as sentences', () => {
|
||||
setLocale('en');
|
||||
assert.equal(
|
||||
sceneSaveFailureReason(new SceneDocumentError('$', 'file exceeds 5 MiB')),
|
||||
'the project is larger than 5 MiB',
|
||||
);
|
||||
assert.equal(
|
||||
sceneSaveFailureReason(
|
||||
new SceneDocumentError('$.scenes[3].shots', 'too many shots in project'),
|
||||
),
|
||||
'the project has too many shots',
|
||||
);
|
||||
});
|
||||
|
||||
test('any other validation failure: English keeps the field, a translation never shows the path', () => {
|
||||
const errors = [
|
||||
new SceneDocumentError(
|
||||
'$.scenes[0].shots[2].layers.x.enabled',
|
||||
'expected a boolean',
|
||||
),
|
||||
new SceneDocumentError('$.scenes[1].anchors[0].id', 'duplicate ID'),
|
||||
new Error('$.scenes[0]: odd'),
|
||||
];
|
||||
setLocale('en');
|
||||
for (const error of errors)
|
||||
assert.equal(sceneSaveFailureReason(error), error.message);
|
||||
assert.equal(
|
||||
sceneSaveFailureReason(null),
|
||||
'the scene data failed validation',
|
||||
);
|
||||
for (const locale of ['ru', 'es']) {
|
||||
setLocale(locale);
|
||||
try {
|
||||
for (const error of [...errors, null]) {
|
||||
const text = sceneSaveFailureReason(error);
|
||||
assert.doesNotMatch(
|
||||
text,
|
||||
/\$\.|expected|duplicate|odd/,
|
||||
`${locale}: ${text}`,
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user