mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
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]>
67 lines
2.5 KiB
JavaScript
67 lines
2.5 KiB
JavaScript
// K-26: every status line of the ChatGPT OAuth flow in Provider Settings goes
|
|
// through t(), and the i18n check treats say() as a place UI text lands.
|
|
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
import {
|
|
extractMessages,
|
|
readCatalog,
|
|
shippedLocales,
|
|
unmarkedScript,
|
|
} from '../scripts/i18n.mjs';
|
|
|
|
// Status-line texts of the ChatGPT OAuth flow in Provider Settings
|
|
// (src/keySetup.js, handler of [data-cloud-voice-auth-toggle]).
|
|
const OAUTH_STATUS_TEXTS = [
|
|
'Cloud voice will use OPENAI_API_KEY on the next session.',
|
|
'Checking local ChatGPT OAuth sign-in…',
|
|
'ChatGPT OAuth selected for cloud voice. Your API key stays saved and available.',
|
|
'ChatGPT sign-in expired. Opening sign-in again…',
|
|
'Opening ChatGPT sign-in in your browser…',
|
|
'Finish ChatGPT sign-in in the browser. Waiting for it to complete…',
|
|
'ChatGPT sign-in timed out. Click {button} to try again.',
|
|
'OAuth check failed: {detail}',
|
|
'Could not check ChatGPT sign-in.',
|
|
'Could not check ChatGPT sign-in. Try again.',
|
|
'Could not start ChatGPT sign-in on this machine.',
|
|
'ChatGPT sign-in complete. OAuth will be used for the next cloud voice session.',
|
|
];
|
|
|
|
test('K-26: OAuth status-line texts are extractable messages with es/ru entries', () => {
|
|
const messages = extractMessages();
|
|
const missing = OAUTH_STATUS_TEXTS.filter((text) => !messages.has(text));
|
|
assert.deepEqual(missing, [], 'texts not wrapped in t() in src/keySetup.js');
|
|
for (const locale of shippedLocales()) {
|
|
const catalog = readCatalog(locale);
|
|
const untranslated = OAUTH_STATUS_TEXTS.filter((text) => !catalog[text]);
|
|
assert.deepEqual(untranslated, [], `${locale}.json lacks entries`);
|
|
}
|
|
});
|
|
|
|
test('K-26: the i18n check sees an unmarked literal passed to say()', () => {
|
|
const sample =
|
|
"const say = (x) => { el.textContent = x; };\nsay('Checking local ChatGPT OAuth sign-in…');\n";
|
|
const found = unmarkedScript('sample.js', sample);
|
|
assert.ok(
|
|
found.some((f) => f.text.includes('Checking local ChatGPT OAuth')),
|
|
'say(...) is not among JS_SINKS in scripts/i18n.mjs',
|
|
);
|
|
});
|
|
|
|
test('K-26: src/keySetup.js has no unmarked say() literals once say is a sink', () => {
|
|
const source = readFileSync(
|
|
new URL('./keySetup.js', import.meta.url),
|
|
'utf8',
|
|
);
|
|
const literal = /\bsay\(\s*['"`]/g;
|
|
const hits = [...source.matchAll(literal)].map(
|
|
(m) => source.slice(0, m.index).split('\n').length,
|
|
);
|
|
assert.deepEqual(
|
|
hits,
|
|
[],
|
|
`say() called with a bare literal at lines ${hits.join(', ')}`,
|
|
);
|
|
});
|