mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(i18n): translate the whole interface
Mark every UI string the unmarked-text check reported (534) plus text it cannot see (helpers, joined labels, runtime-built panels), and translate the result to Spanish and Russian: 1,679 messages each. - Kept on purpose, with the reason where the text lives: provider and product names, place and camera names, codes and units, dB values, the HUD terminal readouts, demo shot titles that saved projects look up by title, and text for AI tools and the voice model. - Modules shared with the server or AI tools stay free of the i18n import (local msg); the wind reading and voice session stay English and are translated where the page shows them. - npm test now runs the unmarked-text check. - Fixes on the way: a duplicated radio privacy paragraph, the contact panel toggle saying Expand while open, the CSS filter mistaking & for CSS. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ee72133574
commit
3129e531e6
99 files changed
+4670
-1294
No files matched your search
+71
-35
@@ -12,6 +12,7 @@ import {
|
||||
} from '../director/authoring.js';
|
||||
import { createSceneDialog, mountSceneSharing } from '../ui/sceneSharing.js';
|
||||
import { PACK_LIMITS } from '../director/packs/manifest.js';
|
||||
import { t, tn } from '../i18n/index.js';
|
||||
|
||||
function download(text, name) {
|
||||
const url = URL.createObjectURL(
|
||||
@@ -91,7 +92,9 @@ export function createSceneSharing(director) {
|
||||
dialog.status.textContent =
|
||||
error?.name === 'SceneDocumentError'
|
||||
? error.message
|
||||
: 'Could not complete this action. Check the file, references and selected assets.';
|
||||
: t(
|
||||
'Could not complete this action. Check the file, references and selected assets.',
|
||||
);
|
||||
} finally {
|
||||
if (alive(owner)) busy = false;
|
||||
}
|
||||
@@ -103,39 +106,64 @@ export function createSceneSharing(director) {
|
||||
layerIds: director.dataManager.getAll().map((l) => l.id),
|
||||
});
|
||||
dialog.text(
|
||||
`${report.scenes} scenes · ${report.shots} shots · ${report.packs.length} data packs`,
|
||||
[
|
||||
tn(report.scenes, '{count} scene', '{count} scenes'),
|
||||
tn(report.shots, '{count} shot', '{count} shots'),
|
||||
tn(report.packs.length, '{count} data pack', '{count} data packs'),
|
||||
].join(' · '),
|
||||
);
|
||||
for (const pack of report.packs)
|
||||
dialog.text(
|
||||
`${pack.scene} / ${pack.id}: ${pack.status}. File: ${pack.path}. ${pack.attribution.text} · ${pack.attribution.license}`,
|
||||
t(
|
||||
'{scene} / {pack}: {status}. File: {path}. {attribution} · {license}',
|
||||
{
|
||||
scene: pack.scene,
|
||||
pack: pack.id,
|
||||
status: pack.status,
|
||||
path: pack.path,
|
||||
attribution: pack.attribution.text,
|
||||
license: pack.attribution.license,
|
||||
},
|
||||
),
|
||||
);
|
||||
if (report.missingLayers.length)
|
||||
dialog.text(`Unavailable layers: ${report.missingLayers.join(', ')}`);
|
||||
dialog.text(
|
||||
t('Unavailable layers: {layers}', {
|
||||
layers: report.missingLayers.join(', '),
|
||||
}),
|
||||
);
|
||||
if (report.externalContent)
|
||||
dialog.text(
|
||||
'This scene uses registered content or linked media. Those external files are not included in a scene bundle. Their original notices still apply.',
|
||||
t(
|
||||
'This scene uses registered content or linked media. Those external files are not included in a scene bundle. Their original notices still apply.',
|
||||
),
|
||||
);
|
||||
if (report.bundledBytes)
|
||||
dialog.text(
|
||||
`${report.bundledBytes} bundled bytes verified. Files stay in memory for this session. Reimport the bundle after reloading the app.`,
|
||||
t(
|
||||
'{bytes} bundled bytes verified. Files stay in memory for this session. Reimport the bundle after reloading the app.',
|
||||
{ bytes: report.bundledBytes },
|
||||
),
|
||||
);
|
||||
return report;
|
||||
}
|
||||
async function preview(file) {
|
||||
const owner = open('Review scene import');
|
||||
const owner = open(t('Review scene import'));
|
||||
if (!owner) return;
|
||||
const expected = currentProject();
|
||||
dialog.text('Nothing is loaded or changed until you apply this file.');
|
||||
dialog.text(t('Nothing is loaded or changed until you apply this file.'));
|
||||
await run(owner, async () => {
|
||||
const input = await readSceneShare(file, { signal: owner.signal });
|
||||
if (!alive(owner)) return;
|
||||
staged = input;
|
||||
inventory(input);
|
||||
dialog.status.textContent = 'Ready to import';
|
||||
dialog.status.textContent = t('Ready to import');
|
||||
dialog.text(
|
||||
'Apply replaces the current project. Export your current project first if you want to keep both.',
|
||||
t(
|
||||
'Apply replaces the current project. Export your current project first if you want to keep both.',
|
||||
),
|
||||
);
|
||||
const apply = dialog.button('Apply import', () =>
|
||||
const apply = dialog.button(t('Apply import'), () =>
|
||||
run(owner, async () => {
|
||||
if (expected !== currentProject()) throw new Error('Project changed');
|
||||
apply.disabled = true;
|
||||
@@ -148,8 +176,9 @@ export function createSceneSharing(director) {
|
||||
if (ok) close();
|
||||
else {
|
||||
apply.disabled = false;
|
||||
dialog.status.textContent =
|
||||
'Import was not applied. The current project may have changed.';
|
||||
dialog.status.textContent = t(
|
||||
'Import was not applied. The current project may have changed.',
|
||||
);
|
||||
}
|
||||
}
|
||||
}),
|
||||
@@ -161,29 +190,31 @@ export function createSceneSharing(director) {
|
||||
const scene = director._getSelectedScene(),
|
||||
shot = scene?.shots.find((s) => s.id === director._selectedShotId);
|
||||
if (!scene || !shot) {
|
||||
director._updateStatus('Select a scene and shot first');
|
||||
director._updateStatus(t('Select a scene and shot first'));
|
||||
return;
|
||||
}
|
||||
const owner = open('Edit scene details');
|
||||
const owner = open(t('Edit scene details'));
|
||||
if (!owner) return;
|
||||
const original = structuredClone(director._project),
|
||||
expected = currentProject();
|
||||
dialog.text(
|
||||
'Camera positions use degrees and meters above the ellipsoid. Drafts are validated before they replace your saved scene.',
|
||||
t(
|
||||
'Camera positions use degrees and meters above the ellipsoid. Drafts are validated before they replace your saved scene.',
|
||||
),
|
||||
);
|
||||
const sceneText = dialog.input(
|
||||
'Anchors and data packs',
|
||||
t('Anchors and data packs'),
|
||||
json(subset(scene, sceneKeys)),
|
||||
{ multiline: true },
|
||||
);
|
||||
const shotText = dialog.input(
|
||||
'Shot camera, timing, packs and actions',
|
||||
t('Shot camera, timing, packs and actions'),
|
||||
json(subset(shot, shotKeys)),
|
||||
{ multiline: true },
|
||||
);
|
||||
const anchorName = dialog.input('New anchor ID', 'anchor-1');
|
||||
const anchorName = dialog.input(t('New anchor ID'), 'anchor-1');
|
||||
dialog.button(
|
||||
'Capture camera as anchor',
|
||||
t('Capture camera as anchor'),
|
||||
() =>
|
||||
run(owner, async () => {
|
||||
const details = JSON.parse(sceneText.value),
|
||||
@@ -210,12 +241,12 @@ export function createSceneSharing(director) {
|
||||
JSON.parse(shotText.value),
|
||||
);
|
||||
sceneText.value = json(details);
|
||||
dialog.status.textContent = 'Anchor added to draft';
|
||||
dialog.status.textContent = t('Anchor added to draft');
|
||||
}),
|
||||
dialog.body,
|
||||
);
|
||||
dialog.button(
|
||||
'Set move start to current camera',
|
||||
t('Set move start to current camera'),
|
||||
() =>
|
||||
run(owner, async () => {
|
||||
const details = JSON.parse(shotText.value),
|
||||
@@ -246,13 +277,14 @@ export function createSceneSharing(director) {
|
||||
details,
|
||||
);
|
||||
shotText.value = json(details);
|
||||
dialog.status.textContent =
|
||||
'Move added to draft; destination remains the shot camera';
|
||||
dialog.status.textContent = t(
|
||||
'Move added to draft; destination remains the shot camera',
|
||||
);
|
||||
}),
|
||||
dialog.body,
|
||||
);
|
||||
dialog.button(
|
||||
'Use ordinary flight',
|
||||
t('Use ordinary flight'),
|
||||
() => {
|
||||
if (!alive(owner)) return;
|
||||
try {
|
||||
@@ -260,12 +292,12 @@ export function createSceneSharing(director) {
|
||||
delete details.move;
|
||||
shotText.value = json(details);
|
||||
} catch {
|
||||
dialog.status.textContent = 'Invalid shot JSON';
|
||||
dialog.status.textContent = t('Invalid shot JSON');
|
||||
}
|
||||
},
|
||||
dialog.body,
|
||||
);
|
||||
const apply = dialog.button('Apply details', () =>
|
||||
const apply = dialog.button(t('Apply details'), () =>
|
||||
run(owner, async () => {
|
||||
if (expected !== currentProject()) throw new Error('Project changed');
|
||||
const project = editSceneDetails(
|
||||
@@ -300,10 +332,10 @@ export function createSceneSharing(director) {
|
||||
director._selectedSceneId,
|
||||
);
|
||||
} catch {
|
||||
director._updateStatus('Select a scene first');
|
||||
director._updateStatus(t('Select a scene first'));
|
||||
return;
|
||||
}
|
||||
const owner = open('Share selected scene');
|
||||
const owner = open(t('Share selected scene'));
|
||||
if (!owner) return;
|
||||
const paths = new Set(
|
||||
project.scenes.flatMap((s) =>
|
||||
@@ -320,19 +352,23 @@ export function createSceneSharing(director) {
|
||||
staged = { project, assets: existing };
|
||||
inventory(staged);
|
||||
dialog.text(
|
||||
'Scene JSON preserves authored settings and attribution. It does not include asset files. Bundles include only pack files you choose here or previously imported bundle files.',
|
||||
t(
|
||||
'Scene JSON preserves authored settings and attribution. It does not include asset files. Bundles include only pack files you choose here or previously imported bundle files.',
|
||||
),
|
||||
);
|
||||
dialog.button('Download scene JSON', () => {
|
||||
dialog.button(t('Download scene JSON'), () => {
|
||||
if (alive(owner)) download(stringifySceneDocument(project), 'scene.json');
|
||||
});
|
||||
const files = dialog.input('Choose data-pack files', '', { type: 'file' });
|
||||
const files = dialog.input(t('Choose data-pack files'), '', {
|
||||
type: 'file',
|
||||
});
|
||||
files.multiple = true;
|
||||
const folder = dialog.input('Or choose a data-pack folder', '', {
|
||||
const folder = dialog.input(t('Or choose a data-pack folder'), '', {
|
||||
type: 'file',
|
||||
});
|
||||
folder.multiple = true;
|
||||
folder.setAttribute('webkitdirectory', '');
|
||||
dialog.button('Download asset bundle', () =>
|
||||
dialog.button(t('Download asset bundle'), () =>
|
||||
run(owner, async () => {
|
||||
const selected = [...files.files, ...folder.files];
|
||||
const packs = project.scenes.flatMap((s) => s.dataPacks || []);
|
||||
@@ -374,7 +410,7 @@ export function createSceneSharing(director) {
|
||||
);
|
||||
if (alive(owner)) {
|
||||
download(text, 'scene.gevbundle.json');
|
||||
dialog.status.textContent = 'Asset bundle downloaded';
|
||||
dialog.status.textContent = t('Asset bundle downloaded');
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user