mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +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
@@ -2,6 +2,17 @@ import { createVoiceControl } from './control.js';
|
||||
import { createVoiceSession } from './session.js';
|
||||
import { VoiceCardControls } from './voiceCard.js';
|
||||
import { PointerReticle } from './pointerReticle.js';
|
||||
import { t, msg } from '../i18n/index.js';
|
||||
|
||||
// Session states are machine values (dataset.status); only the label shown for
|
||||
// them is translated. Unknown states show as they are, upper-cased.
|
||||
const SESSION_STATE_LABELS = Object.freeze({
|
||||
idle: msg('OFF'),
|
||||
connecting: msg('CONNECTING'),
|
||||
listening: msg('LISTENING'),
|
||||
executing: msg('EXECUTING'),
|
||||
error: msg('ERROR'),
|
||||
});
|
||||
|
||||
function createDefaultReticle(pointer) {
|
||||
const element = pointer?.element;
|
||||
@@ -52,8 +63,9 @@ export function createVoiceCommands({
|
||||
if (ui.tierButton) ui.tierButton.hidden = !capabilities.costControls;
|
||||
if (ui.costValue) ui.costValue.hidden = !capabilities.costControls;
|
||||
if (!capabilities.pushToTalk) {
|
||||
ui.button.setAttribute('aria-label', 'Toggle voice control');
|
||||
if (ui.helpDetail) ui.helpDetail.textContent = 'Activate to toggle voice';
|
||||
ui.button.setAttribute('aria-label', t('Toggle voice control'));
|
||||
if (ui.helpDetail)
|
||||
ui.helpDetail.textContent = t('Activate to toggle voice');
|
||||
}
|
||||
// Retain the existing controller's inspection surface for browser tools.
|
||||
const controls = adapter.controller || session;
|
||||
@@ -61,15 +73,21 @@ export function createVoiceCommands({
|
||||
const updateStatus = session.subscribe((event) => {
|
||||
if (event.type !== 'state') return;
|
||||
ui.root.dataset.status = event.state;
|
||||
ui.status.textContent =
|
||||
event.state === 'idle' ? 'OFF' : event.state.toUpperCase();
|
||||
ui.status.textContent = SESSION_STATE_LABELS[event.state]
|
||||
? t(SESSION_STATE_LABELS[event.state])
|
||||
: event.state.toUpperCase();
|
||||
// The session reports 'Voice off' in English: it is portable and has no
|
||||
// locale, so that detail shows as the idle label. Other details are
|
||||
// provider messages and show as they arrive.
|
||||
const idle = event.state === 'idle';
|
||||
const detail = event.detail === 'Voice off' ? '' : event.detail;
|
||||
ui.detail.textContent =
|
||||
event.detail || (event.state === 'idle' ? 'Voice off' : 'Voice active');
|
||||
detail || (idle ? t('Voice off') : t('Voice active'));
|
||||
ui.button.setAttribute('aria-pressed', String(session.isActive()));
|
||||
if (ui.errorDetail)
|
||||
ui.errorDetail.textContent =
|
||||
event.state === 'error'
|
||||
? event.detail || 'Voice could not be started.'
|
||||
? event.detail || t('Voice could not be started.')
|
||||
: '';
|
||||
if (event.state === 'error') ui.root.classList?.remove('error-dismissed');
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user