From d3f249fd1a0d6915bd15047eddeecf326c12bed9 Mon Sep 17 00:00:00 2001 From: DemonGatanjieu <207458273+DemonGatanjieu@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:35:26 +0800 Subject: [PATCH] =?UTF-8?q?Rail=20shows=20=E6=A8=A1=E5=9E=8B=20/=20?= =?UTF-8?q?=E5=9B=BE=E5=BA=93=20again,=20not=20the=20raw=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ce35145 removed 'models' and 'gallery' as unused, but the rail (labelKey) and the page titles (TITLE_KEYS) name them by key. A test now checks every such key in both languages. Co-Authored-By: Claude Opus 5.5 --- tests/shell_labels.mjs | 17 +++++++++++++++++ web/modules/locales.js | 4 ++++ 2 files changed, 21 insertions(+) create mode 100644 tests/shell_labels.mjs diff --git a/tests/shell_labels.mjs b/tests/shell_labels.mjs new file mode 100644 index 0000000..21b6106 --- /dev/null +++ b/tests/shell_labels.mjs @@ -0,0 +1,17 @@ +// The rail's labels and the page titles name their screen words by key (labelKey, TITLE_KEYS), +// so a search for t('…') does not find them: each must still be in both languages. +// (ce35145 removed 'models' and 'gallery' as unused; the rail then showed the raw keys.) +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import { i18n } from '../web/modules/locales.js'; + +const read = name => fs.readFileSync(new URL(`../web/modules/${name}`, import.meta.url), 'utf8'); +const railKeys = [...read('ui_shell_rail.js').matchAll(/labelKey: '([A-Za-z]+)'/g)].map(match => match[1]); +const titles = read('ui_shell_nav.js').match(/const TITLE_KEYS = \{([\s\S]*?)\};/)[1]; +const titleKeys = [...titles.matchAll(/: '([A-Za-z]+)'/g)].map(match => match[1]); + +assert.ok(railKeys.includes('models') && railKeys.includes('gallery')); +assert.ok(titleKeys.includes('gallery')); +for (const key of new Set([...railKeys, ...titleKeys])) { + for (const lang of ['zh', 'en']) assert.ok(i18n[lang][key], `${lang} has no '${key}'`); +} diff --git a/web/modules/locales.js b/web/modules/locales.js index e55f3cb..4f54045 100644 --- a/web/modules/locales.js +++ b/web/modules/locales.js @@ -2569,6 +2569,8 @@ export const i18n = { editRaw: '编辑全文', findPlaceholder: '查找...', replacePlaceholder: '替换为...', + models: '模型', + gallery: '图库', recipeTitle: '工作流', recipeSaveCurrent: '保存当前工作流', recipeSaveTitle: "保存为工作流", @@ -5974,6 +5976,8 @@ export const i18n = { editRaw: 'Edit full text', findPlaceholder: 'Find...', replacePlaceholder: 'Replace with...', + models: 'Models', + gallery: 'Gallery', recipeTitle: 'Workflows', recipeSaveCurrent: 'Save Current Workflow', recipeSaveTitle: "Save workflow",