Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
gui: release notes' section headings read in the GUI's language for every version (Wei He)
yetone881a27506476
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.jsindex fc8e8c24f..6dcf4e69e 100644--- a/internal/gui/assets/app.js+++ b/internal/gui/assets/app.js@@ -4338,9 +4338,9 @@ function showWhatsNew(releases, auto, more = {}) {ok.focus({ preventScroll: true });}-// noteBlocks draws a release's markdown as text: headings, bullets,-// paragraphs, and inline bold, code and links. Nothing in it is taken as-// HTML; #123 links the issue.+// noteBlocks draws a release's markdown as text: headings (tHeading),+// bullets, paragraphs, inline bold, code and links, never as HTML; #123+// links the issue.function noteBlocks(md) {const box = el("div", "wn-notes");let list = null;@@ -4349,7 +4349,7 @@ function noteBlocks(md) {const li = /^\s*[-*+]\s+(.*)$/.exec(line);if (h) {list = null;- box.append(inlineMD(el("div", "wn-h wn-h" + Math.min(h[1].length, 4)), h[2]));+ box.append(inlineMD(el("div", "wn-h wn-h" + Math.min(h[1].length, 4)), tHeading(h[2])));} else if (li) {if (!list) box.append(list = el("ul"));list.append(inlineMD(el("li"), li[1]));diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.jsindex ae3df8674..abd545bd3 100644--- a/internal/gui/assets/i18n.js+++ b/internal/gui/assets/i18n.js@@ -2967,6 +2967,14 @@ const I18N = {"Don't show again today": "今天不再弹出","Couldn't load the release notes": "无法获取更新说明","No release notes provided.": "这个版本没有更新说明。",+ "Features": "新功能",+ "Bug Fixes": "错误修复",+ "Improvements": "改进",+ "Changes": "更新",+ "Documentation": "文档",+ "Performance Improvements": "性能改进",+ "Security": "安全",+ "Provider Changes": "提供商变更","Open the release page": "打开发布页面","Check": "检查","Couldn't check for updates": "检查更新失败",@@ -6820,6 +6828,14 @@ const I18N = {"Don't show again today": "今天不再彈出","Couldn't load the release notes": "無法取得更新說明","No release notes provided.": "這個版本沒有更新說明。",+ "Features": "新功能",+ "Bug Fixes": "錯誤修正",+ "Improvements": "改進",+ "Changes": "更新",+ "Documentation": "文件",+ "Performance Improvements": "效能改進",+ "Security": "安全性",+ "Provider Changes": "供應商變更","Open the release page": "打開發布頁面","Check": "檢查","Couldn't check for updates": "檢查更新失敗",@@ -10685,6 +10701,14 @@ const I18N = {"Don't show again today": "今日はもう表示しない","Couldn't load the release notes": "リリースノートを読み込めませんでした","No release notes provided.": "リリースノートはありません。",+ "Features": "新機能",+ "Bug Fixes": "バグ修正",+ "Improvements": "改善",+ "Changes": "変更点",+ "Documentation": "ドキュメント",+ "Performance Improvements": "パフォーマンス改善",+ "Security": "セキュリティ",+ "Provider Changes": "プロバイダーの変更","Open the release page": "リリースページを開く","Check": "確認","Couldn't check for updates": "アップデートを確認できませんでした",@@ -14560,6 +14584,14 @@ const I18N = {"Don't show again today": "Heute nicht mehr anzeigen","Couldn't load the release notes": "Versionshinweise konnten nicht geladen werden","No release notes provided.": "Keine Versionshinweise vorhanden.",+ "Features": "Neue Funktionen",+ "Bug Fixes": "Fehlerbehebungen",+ "Improvements": "Verbesserungen",+ "Changes": "Änderungen",+ "Documentation": "Dokumentation",+ "Performance Improvements": "Leistungsverbesserungen",+ "Security": "Sicherheit",+ "Provider Changes": "Änderungen an Anbietern","Open the release page": "Release-Seite öffnen","Check": "Prüfen","Couldn't check for updates": "Suche nach Updates fehlgeschlagen",@@ -15654,6 +15686,31 @@ function tNotice(s) {return out.join(/^(zh|ja)/.test(locale) ? "" : " ");}+// tHeading is a release's section heading in the GUI's language (Wei He+// on Discord: past versions' headings switched between Chinese and+// English). The Chinese notes are a model's translation, which keeps the+// English headings in some releases and words them its own way in others+// (功能 or 新功能; 错误修复, 缺陷修复 or Bug 修复), and a release without+// Chinese, or a GUI in a language the notes don't come in, has English+// ones. A heading said either way is the GUI's own word for it; one it+// doesn't know reads as written.+const NOTE_HEADINGS = {+ "Features": ["features", "new features", "功能", "新功能", "新特性", "特性"],+ "Bug Fixes": ["bug fixes", "bug fix", "bugfixes", "fixes", "错误修复", "缺陷修复", "bug 修复", "bug修复", "问题修复", "修复", "錯誤修正", "錯誤修復"],+ "Improvements": ["improvements", "改进", "优化", "改進"],+ "Changes": ["changes", "更新", "变更", "變更"],+ "Documentation": ["documentation", "docs", "文档"],+ "Performance Improvements": ["performance improvements", "performance", "性能改进", "性能优化", "效能改進"],+ "Security": ["security", "安全", "安全性"],+ "Provider Changes": ["provider changes", "提供商变更", "供应商变更", "供應商變更"],+};+let noteHeadingKeys;+function tHeading(s) {+ noteHeadingKeys ??= new Map(Object.entries(NOTE_HEADINGS).flatMap(([k, ws]) => ws.map((w) => [w, k])));+ const k = noteHeadingKeys.get(s.trim().replace(/[::]$/, "").replace(/\s+/g, " ").toLowerCase());+ return k ? t(k) : s;+}+// withNotice is a status line followed by the agent's advice, as the// language ends a sentence.function withNotice(msg, notice) {diff --git a/internal/gui/tests/whats-new.test.cjs b/internal/gui/tests/whats-new.test.cjsindex 6da93923a..227047f5a 100644--- a/internal/gui/tests/whats-new.test.cjs+++ b/internal/gui/tests/whats-new.test.cjs@@ -35,7 +35,10 @@ const NOTES_604 = [].join("\n");const RELEASES = [{ version: "0.1.604", notes: NOTES_604, url: "https://github.com/yetone/magpie-releases/releases/tag/v0.1.604" },- { version: "0.1.603", notes: "## Bug Fixes\n\n- Fixed reading Kimi keys. (#446)" },+ // the Chinese notes' translation words a heading its own way, or keeps+ // the English (Wei He on Discord); a heading magpie doesn't know reads as+ // written+ { version: "0.1.603", notes: "## 缺陷修复\n\n- Fixed reading Kimi keys. (#446)\n\n## Bug fixes:\n\n- Another.\n\n## Thanks\n\n- @someone" },];function settingsPayload(lang) {@@ -84,8 +87,8 @@ function serve(lang, ctl) {}const words = {- en: { quiet: "Don't show again today", title: "What's new in v0.1.604", pendingTitle: "What's new in v0.1.605", close: "Close", again: "What's new", open: "Open", pending: "Not installed yet" },- zh: { quiet: "今天不再弹出", title: "v0.1.604 更新内容", pendingTitle: "v0.1.605 更新内容", close: "关闭", again: "更新内容", open: "打开", pending: "尚未安装" },+ en: { heads: ["Bug Fixes", "Improvements"], heads603: ["Bug Fixes", "Bug Fixes", "Thanks"], headPending: "Features", quiet: "Don't show again today", title: "What's new in v0.1.604", pendingTitle: "What's new in v0.1.605", close: "Close", again: "What's new", open: "Open", pending: "Not installed yet" },+ zh: { heads: ["错误修复", "改进"], heads603: ["错误修复", "错误修复", "Thanks"], headPending: "新功能", quiet: "今天不再弹出", title: "v0.1.604 更新内容", pendingTitle: "v0.1.605 更新内容", close: "关闭", again: "更新内容", open: "打开", pending: "尚未安装" },};for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {@@ -161,7 +164,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",assert.equal(await dialog(page).locator(".ehead b").textContent(), w.title);assert.deepEqual(await dialog(page).locator(".wn-ver b").allTextContents(), ["v0.1.604", "v0.1.603"]);const notes = dialog(page).locator(".wn-rel").first();- assert.deepEqual(await notes.locator(".wn-h").allTextContents(), ["Bug Fixes", "Improvements"]);+ // every release's headings in the page's language, however its notes say them+ assert.deepEqual(await notes.locator(".wn-h").allTextContents(), w.heads);+ assert.deepEqual(await dialog(page).locator(".wn-rel").nth(1).locator(".wn-h").allTextContents(), w.heads603);assert.equal(await notes.locator("li").count(), 3);assert.equal(await notes.locator("li b").first().textContent(), "model picks");assert.equal(await notes.locator("li code").first().textContent(), "providers.json");@@ -237,6 +242,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",assert.equal(await dialog(page).locator(".ehead b").textContent(), w.pendingTitle);assert.deepEqual(await dialog(page).locator(".wn-ver b").allTextContents(), ["v0.1.605", "v0.1.604", "v0.1.603"]);assert.equal(await dialog(page).locator(".wn-rel").first().locator(".badge").textContent(), w.pending);+ assert.deepEqual(await dialog(page).locator(".wn-rel").first().locator(".wn-h").allTextContents(), [w.headPending]);assert.equal(ctl.asked.at(-1), "all");assert.equal(ctl.seen, 1, "asking again isn't a first showing");assert.equal(await dialog(page).getByRole("checkbox").count(), 0, "Settings' notes have no \"don't show again today\"");@@ -246,7 +252,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",await page.keyboard.press("Escape");await page.locator("#modal").waitFor({ state: "hidden" });- const missing = await page.evaluate(() => ["What's new", "What's new in {v}", "The release notes since the last update", "Not installed yet", "Couldn't load the release notes", "Don't show again today"].filter((k) => !I18N.zh[k]));+ const missing = await page.evaluate(() => ["What's new", "What's new in {v}", "The release notes since the last update", "Not installed yet", "Couldn't load the release notes", "Don't show again today", ...Object.keys(NOTE_HEADINGS)].filter((k) => !I18N.zh[k]));assert.deepEqual(missing, [], "every string has its Chinese");assert.deepEqual(errors, []);});