diff --git a/changelog.d/1813-board-state-i18n.fixed.md b/changelog.d/1813-board-state-i18n.fixed.md new file mode 100644 index 000000000..e719252a9 --- /dev/null +++ b/changelog.d/1813-board-state-i18n.fixed.md @@ -0,0 +1 @@ +The Project board's queue rows beside the columns now read **运行中** for a live claim and **已停滞** for a stalled one in the Chinese interface, instead of printing the host's lowercase `running`/`stalled` ids ([#1813](https://github.com/ThinkFlowLab/FlyBot/issues/1813)). diff --git a/core/client.js b/core/client.js index dd4c37710..c767a925a 100644 --- a/core/client.js +++ b/core/client.js @@ -1396,6 +1396,10 @@ var ZH = { "not-started": "未开始", "in-progress": "进行中", "done": "已完成", + // The queue rows beside the columns carry the host's own lease state through the same lookup, + // so the ids that read emits are keys of their own (#1813). + running: "运行中", + stalled: "已停滞", "Projects": "项目", "New Project": "新建项目", "Project name": "项目名称", diff --git a/core/src/client/i18n.js b/core/src/client/i18n.js index 7d40d15cb..30f2e7f62 100644 --- a/core/src/client/i18n.js +++ b/core/src/client/i18n.js @@ -1349,6 +1349,10 @@ const ZH = { 'not-started': '未开始', 'in-progress': '进行中', 'done': '已完成', + // The queue rows beside the columns carry the host's own lease state through the same lookup, + // so the ids that read emits are keys of their own (#1813). + running: '运行中', + stalled: '已停滞', 'Projects': '项目', 'New Project': '新建项目', 'Project name': '项目名称', diff --git a/core/test/i18n.test.js b/core/test/i18n.test.js index 315ddf484..36dac9349 100644 --- a/core/test/i18n.test.js +++ b/core/test/i18n.test.js @@ -49,3 +49,18 @@ test('copy follows the DSH language and stays English without a locale service', assert.equal(t('Model'), 'Model') assert.equal(hostText('A Bot named Writer already exists'), 'A Bot named Writer already exists') }) + +// #1813: the Project board's queue rows print the host's lowercase lease state through `t()` +// (project-board.js), so those ids have to be dictionary keys themselves. #1768's cases never +// bound a dictionary, which is why a missing entry read as raw English in CI. +test('#1813: the Project board queue states read in Chinese', () => { + const off = installLocale(fakeLocale('zh')) + try { + assert.equal(t('running'), '运行中') + assert.equal(t('stalled'), '已停滞') + } finally { + off() + } + // The board keeps emitting the lowercase ids; only the Chinese dictionary changes. + assert.equal(t('running'), 'running') +}) diff --git a/patches/ds-bot/0001-core-fixes.patch b/patches/ds-bot/0001-core-fixes.patch index 2661a9a8d..0462858b0 100644 --- a/patches/ds-bot/0001-core-fixes.patch +++ b/patches/ds-bot/0001-core-fixes.patch @@ -1438,7 +1438,7 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js 'Working folder': '工作文件夹', 'Working folder: {folder}': '工作文件夹:{folder}', Folder: '文件夹', -@@ -838,6 +838,65 @@ +@@ -838,6 +838,69 @@ 'Up one level': '上一级', 'No folders inside.': '里面没有文件夹。', 'Some folders are not shown.': '还有一些文件夹没有显示。', @@ -1459,6 +1459,10 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js + 'not-started': '未开始', + 'in-progress': '进行中', + 'done': '已完成', ++ // The queue rows beside the columns carry the host's own lease state through the same lookup, ++ // so the ids that read emits are keys of their own (#1813). ++ running: '运行中', ++ stalled: '已停滞', + 'Projects': '项目', + 'New Project': '新建项目', + 'Project name': '项目名称', @@ -11542,3 +11546,25 @@ diff --git a/test/work-dir.test.js b/test/work-dir.test.js assert.deepEqual(third.created, [{ cwd: third.project }]) assert.match(await third.tool('list_bots', {}, 'a'), new RegExp(`- Builder \\(Build, works in ${escapeRegExp(third.project)}\\)`)) }) +diff --git a/test/i18n.test.js b/test/i18n.test.js +--- a/test/i18n.test.js ++++ b/test/i18n.test.js +@@ -49,3 +49,18 @@ + assert.equal(t('Model'), 'Model') + assert.equal(hostText('A Bot named Writer already exists'), 'A Bot named Writer already exists') + }) ++ ++// #1813: the Project board's queue rows print the host's lowercase lease state through `t()` ++// (project-board.js), so those ids have to be dictionary keys themselves. #1768's cases never ++// bound a dictionary, which is why a missing entry read as raw English in CI. ++test('#1813: the Project board queue states read in Chinese', () => { ++ const off = installLocale(fakeLocale('zh')) ++ try { ++ assert.equal(t('running'), '运行中') ++ assert.equal(t('stalled'), '已停滞') ++ } finally { ++ off() ++ } ++ // The board keeps emitting the lowercase ids; only the Chinese dictionary changes. ++ assert.equal(t('running'), 'running') ++}) diff --git a/patches/ds-bot/0008-client-bundle.patch b/patches/ds-bot/0008-client-bundle.patch index f46e082f5..ca2ca388d 100644 --- a/patches/ds-bot/0008-client-bundle.patch +++ b/patches/ds-bot/0008-client-bundle.patch @@ -857,7 +857,7 @@ diff --git a/client.js b/client.js "Working folder": "工作文件夹", "Working folder: {folder}": "工作文件夹:{folder}", Folder: "文件夹", -@@ -887,7 +887,66 @@ +@@ -887,7 +887,70 @@ "Use this folder": "使用这个文件夹", "Up one level": "上一级", "No folders inside.": "里面没有文件夹。", @@ -880,6 +880,10 @@ diff --git a/client.js b/client.js + "not-started": "未开始", + "in-progress": "进行中", + "done": "已完成", ++ // The queue rows beside the columns carry the host's own lease state through the same lookup, ++ // so the ids that read emits are keys of their own (#1813). ++ running: "运行中", ++ stalled: "已停滞", + "Projects": "项目", + "New Project": "新建项目", + "Project name": "项目名称", diff --git a/patches/ds-bot/topics.json b/patches/ds-bot/topics.json index 5e1875af0..d18c8d913 100644 --- a/patches/ds-bot/topics.json +++ b/patches/ds-bot/topics.json @@ -54,7 +54,8 @@ "test/session-identity.test.js", "src/host/steward.js", "test/steward.test.js", - "test/steward-retry.test.js" + "test/steward-retry.test.js", + "test/i18n.test.js" ], "0002-flybot-api-host": [ "index.js",