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:
German KhokhlovandClaude Opus 5.5 committed 2026-10-12 19:24:42 +04:00
1 parent ee72133574
commit 3129e531e6
99 files changed
+4670 -1294

No files matched your search

+33 -18
View File
@@ -1,3 +1,4 @@
import { t } from '../i18n/index.js';
import { createRailCards } from './railCards.js';
import { createRailTimeline } from './railTimeline.js';
@@ -15,18 +16,24 @@ const OBSERVED = new Set(ORDER.slice(2));
const utc = (time) =>
Number.isFinite(Date.parse(time))
? `${new Date(time).toISOString().slice(5, 16).replace('T', ' ')} UTC`
: 'Unavailable';
: t('Unavailable');
const age = (time) => {
const minutes = Math.max(
0,
Math.floor((Date.now() - Date.parse(time)) / 60_000),
);
return minutes >= 60
? `${Math.floor(minutes / 60)}h ${minutes % 60}m ago`
: `${minutes}m ago`;
? t('{hours}h {minutes}m ago', {
hours: Math.floor(minutes / 60),
minutes: minutes % 60,
})
: t('{minutes}m ago', { minutes });
};
const historyTime = (time) =>
`${utc(time).slice(6)} · ${Math.max(0, Math.floor((Date.now() - Date.parse(time)) / 60_000))} min ago`;
t('{time} · {minutes} min ago', {
time: utc(time).slice(6),
minutes: Math.max(0, Math.floor((Date.now() - Date.parse(time)) / 60_000)),
});
const dated = (time) => `${utc(time)} · ${age(time)}`;
const set = (node, key, value) => {
if (node[key] !== value) node[key] = value;
@@ -63,7 +70,7 @@ export function createWeatherPanel({
const root = document.createElement('section');
root.className = 'weather-readout';
root.hidden = true;
root.setAttribute('aria-label', 'Active weather');
root.setAttribute('aria-label', t('Active weather'));
const timelineHost = document.createElement('div');
timelineHost.className = 'weather-timeline-block';
timelineHost.hidden = true;
@@ -71,10 +78,10 @@ export function createWeatherPanel({
cardsHost.className = 'weather-cards';
const observedGroup = document.createElement('section');
observedGroup.className = 'weather-observed-group';
observedGroup.setAttribute('aria-label', 'Observed history');
observedGroup.setAttribute('aria-label', t('Observed history'));
const heading = document.createElement('h3');
heading.className = 'panel-title';
heading.textContent = 'Observed history';
heading.textContent = t('Observed history');
const scope = document.createElement('div');
scope.className = 'weather-observed-scope';
const observedCardsHost = document.createElement('div');
@@ -132,9 +139,9 @@ export function createWeatherPanel({
const showTimeline = observed.length > 0;
set(observedGroup, 'hidden', !showTimeline);
const names = {
'weather-radar': 'Rain radar',
'weather-satellite': 'Satellite clouds',
'weather-lightning': 'Lightning density',
'weather-radar': t('Rain radar'),
'weather-satellite': t('Satellite clouds'),
'weather-lightning': t('Lightning density'),
};
set(scope, 'textContent', observed.map(({ id }) => names[id]).join(' · '));
set(timelineHost, 'hidden', !showTimeline);
@@ -155,7 +162,7 @@ export function createWeatherPanel({
disabled: !showTimeline || state.timeline.length < 2,
readout:
state.mode === 'latest'
? 'LATEST · newest per product'
? t('LATEST · newest per product')
: historyTime(state.target),
});
const models = active.map(({ id, icon, summary, legend = [], list }) => {
@@ -165,18 +172,26 @@ export function createWeatherPanel({
const shown = product?.shown ?? summary.shownTime;
if (state.mode === 'history' && product?.selected === null) {
const gap = summary.maxGapMinutes || 30;
detail = `No frame within ${gap < 60 ? `${gap} min` : `${gap / 60} h`} of ${utc(state.target).slice(6)}`;
const time = utc(state.target).slice(6);
detail =
gap < 60
? t('No frame within {gap} min of {time}', { gap, time })
: t('No frame within {gap} h of {time}', { gap: gap / 60, time });
} else if (shown) {
detail = dated(shown);
if (state.mode === 'history')
detail +=
detail =
Date.parse(shown) === Date.parse(state.target)
? ' · synced'
: ' · nearest';
? t('{detail} · synced', { detail })
: t('{detail} · nearest', { detail });
}
} else if (id === 'wind') {
detail = `Forecast · valid ${utc(summary.validTime)} · issued ${utc(summary.issuedTime)}`;
if (state.mode === 'history') detail += ' · Does not follow history';
detail = t('Forecast · valid {valid} · issued {issued}', {
valid: utc(summary.validTime),
issued: utc(summary.issuedTime),
});
if (state.mode === 'history')
detail = t('{detail} · Does not follow history', { detail });
}
const lines = [
{ id: 'time', text: detail, muted: true },
@@ -222,7 +237,7 @@ export function createWeatherPanel({
summary.status ||
summary.compact ||
(id === 'wind'
? `Forecast · valid ${utc(summary.validTime)}`
? t('Forecast · valid {valid}', { valid: utc(summary.validTime) })
: detail),
compactStatus: Boolean(summary.status),
blocks,