gui: i18n.js has each Chinese string once, and i18n-keys.test.cjs fails when a language has a key twice
Eight zh keys were written twice (Close, model {model}, Import…, Time,
Web search ×3, Looking…, {name} is up to date). In an object literal the
later copy wins, so an edit to the first would silently do nothing. The
copies held the same text, so the later ones are removed: the I18N object
is deep-equal before and after. ja and de had none.
i18n-keys.test.cjs is new and needs no browser; it lists the 8 on the
old file and passes on the new one. The ja/de placeholder check run by
gui-ja/gui-de finds 0 mismatches.
This commit is contained in:
@@ -1153,7 +1153,6 @@ const I18N = {
|
||||
"from a link": "来自链接",
|
||||
"Fetching {host}’s icon…": "正在获取 {host} 的图标…",
|
||||
"the vendor": "该厂商",
|
||||
"Close": "关闭",
|
||||
"This link can't be imported: {e}": "这个链接无法导入:{e}",
|
||||
"Added from a link. Your prompts and this key will go to {hosts}; add it only if you trust the site that sent you here.": "从链接导入。你的提示词和此密钥将发往 {hosts};仅在信任发来链接的网站时添加。",
|
||||
"From the link. Kept in ~/.config/magpie/providers.json, readable by you alone.": "来自链接。保存在 ~/.config/magpie/providers.json,仅你自己可读。",
|
||||
@@ -1454,7 +1453,6 @@ const I18N = {
|
||||
"model to try · empty picks one from the vendor's list": "试用的模型 · 留空则从供应商的模型列表中挑选",
|
||||
"Type the base URL first": "请先填写 Base URL",
|
||||
"Asking each API…": "正在逐个检测协议…",
|
||||
"model {model}": "模型 {model}",
|
||||
"None answered: check the URL and the key, or type a model the vendor serves": "都没有响应:请检查地址和密钥,或填写一个供应商提供的模型",
|
||||
"Use these": "使用检测结果",
|
||||
"Set the URLs of the APIs that answered; one not found there is cleared": "填入有响应的协议地址;不存在的协议地址会被清空",
|
||||
@@ -1579,7 +1577,6 @@ const I18N = {
|
||||
"OK": "知道了",
|
||||
"Export": "导出", "Export…": "导出…",
|
||||
"Everything above in one file, sealed with a passphrase, to carry to another computer": "把上面这些打包成一个用口令加密的文件,带到另一台电脑",
|
||||
"Import…": "导入…",
|
||||
"Bring in a file exported from magpie": "导入从 magpie 导出的文件",
|
||||
"user name": "用户名",
|
||||
"saved · type a new one to replace it": "已保存 · 输入新的即可替换",
|
||||
@@ -2390,7 +2387,6 @@ const I18N = {
|
||||
"Rules": "规则",
|
||||
"Add a rule": "添加规则",
|
||||
"When": "当",
|
||||
"Time": "时间",
|
||||
"has an image": "带图片",
|
||||
"compacting": "压缩上下文时",
|
||||
"from": "从",
|
||||
@@ -2720,7 +2716,6 @@ const I18N = {
|
||||
"Luna Reserve": "Luna 储备",
|
||||
"Suggestions": "提示词建议",
|
||||
"Background prompt suggestions": "后台提示词建议",
|
||||
"Web search": "联网搜索",
|
||||
"magpie ran this web search for {agent}'s {model}, which can't search the web by itself: {searcher} searched, and {model} goes on answering once it has what was found. Not a turn of the conversation.": "magpie 代 {agent} 的 {model} 发起的联网搜索:{model} 无法自行搜索,由 {searcher} 搜索,{model} 拿到结果后继续回答。不属于对话轮次。",
|
||||
"magpie ran this web search for a model that can't search the web by itself: {searcher} searched, and that model goes on answering once it has what was found. Not a turn of the conversation.": "magpie 代一个无法自行搜索的模型发起的联网搜索:由 {searcher} 搜索,该模型拿到结果后继续回答。不属于对话轮次。",
|
||||
"Image description": "图片描述",
|
||||
@@ -3008,7 +3003,6 @@ const I18N = {
|
||||
"Forget": "清除",
|
||||
"Drop the list fetched from the vendor; the models.dev one is used until Refresh": "丢弃从供应商拉取的列表;在重新刷新前使用 models.dev 的列表",
|
||||
"Only through routing groups": "只通过路由分组使用",
|
||||
"Web search": "联网搜索",
|
||||
"Searches the web by itself": "自己能联网搜索",
|
||||
"DeepSeek models only from DeepSeek's own API": "DeepSeek 模型只走 DeepSeek 官方上游",
|
||||
"Upstream": "上游",
|
||||
@@ -3155,7 +3149,6 @@ const I18N = {
|
||||
"Claude Code asks before it starts a project's servers; Codex reads .codex/config.toml, and Pi .pi/mcp.json, only in a project you trust.": "Claude Code 启动项目服务器前会先询问;Codex 的 .codex/config.toml 和 Pi 的 .pi/mcp.json 仅在受信任的项目中读取。",
|
||||
"{agents} reads no project MCP file magpie knows of.": "{agents} 没有 magpie 已知的项目 MCP 文件。",
|
||||
"owner/repo, a GitHub link, or a folder on this computer": "owner/repo、GitHub 链接,或本机上的文件夹",
|
||||
"Looking…": "查找中…",
|
||||
"Find skills": "查找技能",
|
||||
"No SKILL.md found there": "那里没有找到 SKILL.md",
|
||||
"No skills there — a skill is a folder with a SKILL.md in it.": "那里没有技能 — 技能是一个含 SKILL.md 的文件夹。",
|
||||
@@ -3358,7 +3351,6 @@ const I18N = {
|
||||
"npm package or a folder on this computer": "npm 包名,或本机上的文件夹",
|
||||
"npm package, GitHub repo (github:owner/repo) or a folder": "npm 包名、GitHub 仓库(github:owner/repo)或本机文件夹",
|
||||
"Fetches it from {repo} again": "重新从 {repo} 获取",
|
||||
"{name} is up to date": "{name} 已是最新",
|
||||
"Choose a folder on this computer": "选择本机上的一个文件夹",
|
||||
"Choose a folder": "选择文件夹",
|
||||
"No plugins yet": "还没有插件",
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Run with Node's test runner; needs no browser. A key written twice in one
|
||||
// language of i18n.js is a trap: the later one silently wins, so an edit to
|
||||
// the first does nothing. Every key appears once per language.
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("node:path");
|
||||
const { test } = require("node:test");
|
||||
|
||||
test("no language in i18n.js has a key twice", async () => {
|
||||
const src = await fs.readFile(path.resolve(__dirname, "../assets/i18n.js"), "utf8");
|
||||
const body = src.slice(0, src.indexOf("\n};"));
|
||||
const twice = [];
|
||||
let lang, seen;
|
||||
body.split("\n").forEach((line, i) => {
|
||||
const head = line.match(/^ (\w+): \{/);
|
||||
if (head) return void ((lang = head[1]), (seen = new Map()));
|
||||
const key = line.match(/^ ("(?:[^"\\]|\\.)*")\s*:/);
|
||||
if (!key || !lang) return;
|
||||
if (seen.has(key[1])) twice.push(`${lang} ${key[1]}: lines ${seen.get(key[1])} and ${i + 1}`);
|
||||
else seen.set(key[1], i + 1);
|
||||
});
|
||||
assert.deepEqual(twice, []);
|
||||
});
|
||||
Reference in New Issue
Block a user