diff --git a/changelog.d/3220-add-friend-zh.fixed.md b/changelog.d/3220-add-friend-zh.fixed.md new file mode 100644 index 000000000..8c4ceb07c --- /dev/null +++ b/changelog.d/3220-add-friend-zh.fixed.md @@ -0,0 +1 @@ +The Add friend panel now reads in the window's language: its headings, the invite paste box, both Bot pickers and the Copy link / Copy with instructions / New link controls no longer draw bare English in a Chinese window ([#3114](https://github.com/ThinkFlowLab/FlyBot/issues/3114)). diff --git a/core/client.js b/core/client.js index 25731e984..1f57b0db5 100644 --- a/core/client.js +++ b/core/client.js @@ -1741,7 +1741,33 @@ var HOST_ZH = { "This DeepSeek Harness has no folder chooser": "这个 DeepSeek Harness 没有文件夹选择窗口", "This DeepSeek Harness cannot list folders": "这个 DeepSeek Harness 不能列出文件夹", "No FlyBot core update is available": "没有可用的 FlyBot 核心更新", - "saved by a newer FlyBot; update FlyBot": "由更新的 FlyBot 保存;请更新 FlyBot" + "saved by a newer FlyBot; update FlyBot": "由更新的 FlyBot 保存;请更新 FlyBot", + // #3114 cut 22: the Add friend panel — both headings, the paste box, both Bot pickers, the invite controls. + "Accept an invite": "接受邀请", + "Invite a friend": "邀请朋友", + "Paste invite link or code": "粘贴邀请链接或邀请码", + "Invite link or code": "邀请链接或邀请码", + "Talk through ": "通过", + "Which of your Bots talks": "哪个 Bot 替你说话", + "Talks for you. Not shared: your friend can't use it unless you invite them to it.": "这个 Bot 替你说话,不会被共享;除非你邀请,否则你的朋友用不了它。", + "Share ": "分享", + "Which of your Bots to share": "分享哪个 Bot", + "Your friend gets this Bot only.": "你的朋友只会拿到这个 Bot。", + "You are {me}": "你是 {me}", + "Copy invite link for {bot}": "复制给 {bot} 的邀请链接", + "Invite link for {bot}": "{bot} 的邀请链接", + "Copy with instructions": "连说明一起复制", + "Invite for {bot} copied with instructions.": "{bot} 的邀请已复制(含说明)。", + "Invite link for {bot} copied.": "{bot} 的邀请链接已复制。", + "Could not copy. Select the link and copy it by hand.": "复制失败。请选中链接手动复制。", + "{bots} {verb} back in your list.": "{bots} 又回到了你的列表里。", + "{who} shared {bot} with you.{note}": "{who} 把 {bot} 分享给了你。{note}", + "Joined {who}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.{note}": "你已加入 {who} 的邀请,但对方的 Bot 还没加载出来。加载后它会出现在你的列表里;如果没有,请重新接受这个链接。{note}", + "Request sent to {who}. They show up here once they accept.": "已向 {who} 发出请求。对方接受后会出现在这里。", + "{name} is now a friend.": "{name} 现在成了你的朋友。", + "Declined {name}.": "已拒绝 {name}。", + "{what} failed: {why}": "{what} 失败:{why}", + "Your friend": "你的朋友" }; Object.assign(ZH, HOST_ZH); var fill = (text2, params) => params ? text2.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match) : text2; diff --git a/core/src/client/i18n.js b/core/src/client/i18n.js index cb613c248..c060d722b 100644 --- a/core/src/client/i18n.js +++ b/core/src/client/i18n.js @@ -1702,6 +1702,32 @@ const HOST_ZH = { 'This DeepSeek Harness cannot list folders': '这个 DeepSeek Harness 不能列出文件夹', 'No FlyBot core update is available': '没有可用的 FlyBot 核心更新', 'saved by a newer FlyBot; update FlyBot': '由更新的 FlyBot 保存;请更新 FlyBot', + // #3114 cut 22: the Add friend panel — both headings, the paste box, both Bot pickers, the invite controls. + 'Accept an invite': '接受邀请', + 'Invite a friend': '邀请朋友', + 'Paste invite link or code': '粘贴邀请链接或邀请码', + 'Invite link or code': '邀请链接或邀请码', + 'Talk through ': '通过', + 'Which of your Bots talks': '哪个 Bot 替你说话', + "Talks for you. Not shared: your friend can't use it unless you invite them to it.": '这个 Bot 替你说话,不会被共享;除非你邀请,否则你的朋友用不了它。', + 'Share ': '分享', + 'Which of your Bots to share': '分享哪个 Bot', + 'Your friend gets this Bot only.': '你的朋友只会拿到这个 Bot。', + 'You are {me}': '你是 {me}', + 'Copy invite link for {bot}': '复制给 {bot} 的邀请链接', + 'Invite link for {bot}': '{bot} 的邀请链接', + 'Copy with instructions': '连说明一起复制', + 'Invite for {bot} copied with instructions.': '{bot} 的邀请已复制(含说明)。', + 'Invite link for {bot} copied.': '{bot} 的邀请链接已复制。', + 'Could not copy. Select the link and copy it by hand.': '复制失败。请选中链接手动复制。', + '{bots} {verb} back in your list.': '{bots} 又回到了你的列表里。', + '{who} shared {bot} with you.{note}': '{who} 把 {bot} 分享给了你。{note}', + "Joined {who}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.{note}": '你已加入 {who} 的邀请,但对方的 Bot 还没加载出来。加载后它会出现在你的列表里;如果没有,请重新接受这个链接。{note}', + 'Request sent to {who}. They show up here once they accept.': '已向 {who} 发出请求。对方接受后会出现在这里。', + '{name} is now a friend.': '{name} 现在成了你的朋友。', + 'Declined {name}.': '已拒绝 {name}。', + '{what} failed: {why}': '{what} 失败:{why}', + 'Your friend': '你的朋友', } Object.assign(ZH, HOST_ZH) diff --git a/core/test/i18n-missing-entries.baseline.json b/core/test/i18n-missing-entries.baseline.json index 71c8c7ace..4ce593b0e 100644 --- a/core/test/i18n-missing-entries.baseline.json +++ b/core/test/i18n-missing-entries.baseline.json @@ -2,29 +2,19 @@ "version": 1, "entries": [ "plugins/social/client.js: +{} more", - "plugins/social/client.js:Accept an invite", "plugins/social/client.js:Anyone with the link can join while the room is open.", "plugins/social/client.js:Bot Social could not look up that link right now. Try again.", "plugins/social/client.js:Chat paused", "plugins/social/client.js:Choose which of your Bots join.", - "plugins/social/client.js:Copy with instructions", - "plugins/social/client.js:Could not copy. Select the link and copy it by hand.#1", - "plugins/social/client.js:Could not copy. Select the link and copy it by hand.#2", "plugins/social/client.js:Could not reach FlyBot. Check that it is still running.", - "plugins/social/client.js:Declined {}.", "plugins/social/client.js:Don't ask each time.#1", "plugins/social/client.js:Don't ask each time.#2", "plugins/social/client.js:Enter a 6-digit number.", "plugins/social/client.js:FlyBot cannot use the camera. Allow the camera for this page, or type the 6-digit number instead.", "plugins/social/client.js:In use in {} room{}: ", - "plugins/social/client.js:Invite a friend", - "plugins/social/client.js:Invite for {} copied with instructions.", - "plugins/social/client.js:Invite link for {} copied.", - "plugins/social/client.js:Invite link or code", "plugins/social/client.js:Invites need a newer Bot Social. The 6-digit number still works.#1", "plugins/social/client.js:Invites need a newer Bot Social. The 6-digit number still works.#2", "plugins/social/client.js:Invites need a newer Bot Social. The 6-digit number still works.#3", - "plugins/social/client.js:Joined {}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.{}", "plugins/social/client.js:Joining with that link…#1", "plugins/social/client.js:Joining with that link…#2", "plugins/social/client.js:Link ready", @@ -32,7 +22,6 @@ "plugins/social/client.js:Looking up that room…#1", "plugins/social/client.js:Looking up that room…#2", "plugins/social/client.js:Past rooms", - "plugins/social/client.js:Paste invite link or code", "plugins/social/client.js:Point the camera at a FlyBot room code.", "plugins/social/client.js:QR code for this room invite", "plugins/social/client.js:Remove this Bot from Friends' Bots and from your groups. This does not unfriend the owner.", @@ -40,16 +29,12 @@ "plugins/social/client.js:Remove this Bot#1", "plugins/social/client.js:Remove this Bot#2", "plugins/social/client.js:Removing…", - "plugins/social/client.js:Request sent to {}. They show up here once they accept.", "plugins/social/client.js:Scan to open this room", "plugins/social/client.js:Scanned a group link.", "plugins/social/client.js:Scanned an invite link.", - "plugins/social/client.js:Share ", "plugins/social/client.js:Social is not running: the plugin did not start. See Settings → Feedback.", "plugins/social/client.js:Social#1", "plugins/social/client.js:Social#2", - "plugins/social/client.js:Talk through ", - "plugins/social/client.js:Talks for you. Not shared: your friend can't use it unless you invite them to it.", "plugins/social/client.js:That is not a FlyBot room code. Ask for the 6-digit number instead.", "plugins/social/client.js:That is not an invite link. It looks like https://…/r/…", "plugins/social/client.js:That link cannot seat these Bots. Ask for a new one.", @@ -67,17 +52,11 @@ "plugins/social/client.js:This invite was already used. Ask your friend for a new one.", "plugins/social/client.js:This room only: ", "plugins/social/client.js:Too many tries for now. Wait a minute and try again.", - "plugins/social/client.js:Which of your Bots talks", - "plugins/social/client.js:Which of your Bots to share", "plugins/social/client.js:You already joined with that link using other Bots. Leave the group first to join with different ones.", - "plugins/social/client.js:Your friend gets this Bot only.", "plugins/social/client.js:Your own Bots stay shared. {} can share it again.", "plugins/social/client.js:the group", "plugins/social/client.js:the room", - "plugins/social/client.js:{} is now a friend.", - "plugins/social/client.js:{} shared {} with you.{}", "plugins/social/client.js:{} stays a friend: still shared through {}.", - "plugins/social/client.js:{} {} back in your list.", "plugins/timeline/client.js:Communication map: who sent requests to whom", "plugins/timeline/client.js:Copy report", "plugins/timeline/client.js:Copy this window as a Markdown report", diff --git a/core/test/i18n-missing-entries.test.js b/core/test/i18n-missing-entries.test.js index 015761596..e139da22f 100644 --- a/core/test/i18n-missing-entries.test.js +++ b/core/test/i18n-missing-entries.test.js @@ -82,7 +82,7 @@ test('the scan counts copy tables and copy props, not data', () => { test('the widened scan names every copy attribute and skips placeholder examples', () => { const source = [ "h(Button, { title: 'Archive this room', 'aria-label': 'Archive this room' })", - "h('input', { placeholder: 'Paste invite link or code' })", + "h('input', { placeholder: 'Type a room name' })", "h('input', { placeholder: 'https://social.example' })", "h('input', { placeholder: 'github, composio' })", "h(Picture, { alt: 'A picture of the room' })", @@ -93,7 +93,7 @@ test('the widened scan names every copy attribute and skips placeholder examples assert.deepEqual(keys, [ 'Archive this room', 'Archive this room', - 'Paste invite link or code', + 'Type a room name', 'A picture of the room', 'Type a name', 'Explains the row', diff --git a/core/test/i18n-plugins.baseline.json b/core/test/i18n-plugins.baseline.json index 7640c6bf8..81e8a6915 100644 --- a/core/test/i18n-plugins.baseline.json +++ b/core/test/i18n-plugins.baseline.json @@ -5,8 +5,6 @@ "plugins/social/client.js:Copied#1", "plugins/social/client.js:Copied#2", "plugins/social/client.js:Copy", - "plugins/social/client.js:Copy link", - "plugins/social/client.js:New link", "plugins/social/client.js:Your Bot Social handle", "plugins/social/client.js:Your Bots", "plugins/timeline/client.js:Close", diff --git a/core/test/i18n-template-draws.baseline.json b/core/test/i18n-template-draws.baseline.json index f034dbc7b..7d03d4805 100644 --- a/core/test/i18n-template-draws.baseline.json +++ b/core/test/i18n-template-draws.baseline.json @@ -5,18 +5,14 @@ "plugins/social/client.js:Auto-send my Bots' replies to {}", "plugins/social/client.js:Auto-send {} → room", "plugins/social/client.js:Auto-send {}'s room messages", - "plugins/social/client.js:Copy invite link for {}", "plugins/social/client.js:Invite grants {} only.", "plugins/social/client.js:Invite grants {} only. Revoke anytime in People with access.", - "plugins/social/client.js:Invite link for {}", "plugins/social/client.js:Remove {} from your list? {}", "plugins/social/client.js:Scanned {}.", "plugins/social/client.js:Scanned {}. Pick a Bot to join.", "plugins/social/client.js:Waiting for {} to let you in. If the group does not appear, press Join group to ask again.", - "plugins/social/client.js:You are {}", "plugins/social/client.js:Your Bots' replies to {} go out without asking you first. What you type is not affected.", "plugins/social/client.js:{} Send your message again: it starts a new chat.", - "plugins/social/client.js:{} failed: {}", "plugins/timeline/client.js:Could not copy the report: {}", "plugins/timeline/client.js:Last {}", "plugins/timeline/client.js:Looking back: window ends at {}.", diff --git a/patches/ds-bot/0001-core-fixes.patch b/patches/ds-bot/0001-core-fixes.patch index 46b3f611a..98b06c206 100644 --- a/patches/ds-bot/0001-core-fixes.patch +++ b/patches/ds-bot/0001-core-fixes.patch @@ -2005,12 +2005,38 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js 'The admin must be a member of the group': '管理员必须是群成员', 'Unknown group chat': '找不到这个群聊', 'Hand the admin role to another member instead of leaving the group without one': '请把管理员交给其他成员,不要让群聊没有管理员', -@@ -905,6 +905,8 @@ const HOST_ZH = { +@@ -905,6 +905,34 @@ const HOST_ZH = { 'Write the entry to save.': '请写下要保存的内容。', 'This DeepSeek Harness has no folder chooser': '这个 DeepSeek Harness 没有文件夹选择窗口', 'This DeepSeek Harness cannot list folders': '这个 DeepSeek Harness 不能列出文件夹', + 'No FlyBot core update is available': '没有可用的 FlyBot 核心更新', + 'saved by a newer FlyBot; update FlyBot': '由更新的 FlyBot 保存;请更新 FlyBot', ++ // #3114 cut 22: the Add friend panel — both headings, the paste box, both Bot pickers, the invite controls. ++ 'Accept an invite': '接受邀请', ++ 'Invite a friend': '邀请朋友', ++ 'Paste invite link or code': '粘贴邀请链接或邀请码', ++ 'Invite link or code': '邀请链接或邀请码', ++ 'Talk through ': '通过', ++ 'Which of your Bots talks': '哪个 Bot 替你说话', ++ "Talks for you. Not shared: your friend can't use it unless you invite them to it.": '这个 Bot 替你说话,不会被共享;除非你邀请,否则你的朋友用不了它。', ++ 'Share ': '分享', ++ 'Which of your Bots to share': '分享哪个 Bot', ++ 'Your friend gets this Bot only.': '你的朋友只会拿到这个 Bot。', ++ 'You are {me}': '你是 {me}', ++ 'Copy invite link for {bot}': '复制给 {bot} 的邀请链接', ++ 'Invite link for {bot}': '{bot} 的邀请链接', ++ 'Copy with instructions': '连说明一起复制', ++ 'Invite for {bot} copied with instructions.': '{bot} 的邀请已复制(含说明)。', ++ 'Invite link for {bot} copied.': '{bot} 的邀请链接已复制。', ++ 'Could not copy. Select the link and copy it by hand.': '复制失败。请选中链接手动复制。', ++ '{bots} {verb} back in your list.': '{bots} 又回到了你的列表里。', ++ '{who} shared {bot} with you.{note}': '{who} 把 {bot} 分享给了你。{note}', ++ "Joined {who}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.{note}": '你已加入 {who} 的邀请,但对方的 Bot 还没加载出来。加载后它会出现在你的列表里;如果没有,请重新接受这个链接。{note}', ++ 'Request sent to {who}. They show up here once they accept.': '已向 {who} 发出请求。对方接受后会出现在这里。', ++ '{name} is now a friend.': '{name} 现在成了你的朋友。', ++ 'Declined {name}.': '已拒绝 {name}。', ++ '{what} failed: {why}': '{what} 失败:{why}', ++ 'Your friend': '你的朋友', } Object.assign(ZH, HOST_ZH) diff --git a/patches/ds-bot/0008-client-bundle.patch b/patches/ds-bot/0008-client-bundle.patch index ccbb60544..f5d82a148 100644 --- a/patches/ds-bot/0008-client-bundle.patch +++ b/patches/ds-bot/0008-client-bundle.patch @@ -1267,14 +1267,40 @@ diff --git a/client.js b/client.js "The admin must be a member of the group": "管理员必须是群成员", "Unknown group chat": "找不到这个群聊", "Hand the admin role to another member instead of leaving the group without one": "请把管理员交给其他成员,不要让群聊没有管理员", -@@ -951,10 +951,12 @@ var HOST_ZH = { +@@ -951,10 +951,38 @@ var HOST_ZH = { "The model wrote nothing": "模型没有输出内容", "Write the entry to save.": "请写下要保存的内容。", "This DeepSeek Harness has no folder chooser": "这个 DeepSeek Harness 没有文件夹选择窗口", - "This DeepSeek Harness cannot list folders": "这个 DeepSeek Harness 不能列出文件夹" + "This DeepSeek Harness cannot list folders": "这个 DeepSeek Harness 不能列出文件夹", + "No FlyBot core update is available": "没有可用的 FlyBot 核心更新", -+ "saved by a newer FlyBot; update FlyBot": "由更新的 FlyBot 保存;请更新 FlyBot" ++ "saved by a newer FlyBot; update FlyBot": "由更新的 FlyBot 保存;请更新 FlyBot", ++ // #3114 cut 22: the Add friend panel — both headings, the paste box, both Bot pickers, the invite controls. ++ "Accept an invite": "接受邀请", ++ "Invite a friend": "邀请朋友", ++ "Paste invite link or code": "粘贴邀请链接或邀请码", ++ "Invite link or code": "邀请链接或邀请码", ++ "Talk through ": "通过", ++ "Which of your Bots talks": "哪个 Bot 替你说话", ++ "Talks for you. Not shared: your friend can't use it unless you invite them to it.": "这个 Bot 替你说话,不会被共享;除非你邀请,否则你的朋友用不了它。", ++ "Share ": "分享", ++ "Which of your Bots to share": "分享哪个 Bot", ++ "Your friend gets this Bot only.": "你的朋友只会拿到这个 Bot。", ++ "You are {me}": "你是 {me}", ++ "Copy invite link for {bot}": "复制给 {bot} 的邀请链接", ++ "Invite link for {bot}": "{bot} 的邀请链接", ++ "Copy with instructions": "连说明一起复制", ++ "Invite for {bot} copied with instructions.": "{bot} 的邀请已复制(含说明)。", ++ "Invite link for {bot} copied.": "{bot} 的邀请链接已复制。", ++ "Could not copy. Select the link and copy it by hand.": "复制失败。请选中链接手动复制。", ++ "{bots} {verb} back in your list.": "{bots} 又回到了你的列表里。", ++ "{who} shared {bot} with you.{note}": "{who} 把 {bot} 分享给了你。{note}", ++ "Joined {who}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.{note}": "你已加入 {who} 的邀请,但对方的 Bot 还没加载出来。加载后它会出现在你的列表里;如果没有,请重新接受这个链接。{note}", ++ "Request sent to {who}. They show up here once they accept.": "已向 {who} 发出请求。对方接受后会出现在这里。", ++ "{name} is now a friend.": "{name} 现在成了你的朋友。", ++ "Declined {name}.": "已拒绝 {name}。", ++ "{what} failed: {why}": "{what} 失败:{why}", ++ "Your friend": "你的朋友" }; Object.assign(ZH, HOST_ZH); -var fill = (text, params) => params ? text.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match) : text; diff --git a/patches/ds-bot/files/test/i18n-missing-entries.baseline.json b/patches/ds-bot/files/test/i18n-missing-entries.baseline.json index 71c8c7ace..4ce593b0e 100644 --- a/patches/ds-bot/files/test/i18n-missing-entries.baseline.json +++ b/patches/ds-bot/files/test/i18n-missing-entries.baseline.json @@ -2,29 +2,19 @@ "version": 1, "entries": [ "plugins/social/client.js: +{} more", - "plugins/social/client.js:Accept an invite", "plugins/social/client.js:Anyone with the link can join while the room is open.", "plugins/social/client.js:Bot Social could not look up that link right now. Try again.", "plugins/social/client.js:Chat paused", "plugins/social/client.js:Choose which of your Bots join.", - "plugins/social/client.js:Copy with instructions", - "plugins/social/client.js:Could not copy. Select the link and copy it by hand.#1", - "plugins/social/client.js:Could not copy. Select the link and copy it by hand.#2", "plugins/social/client.js:Could not reach FlyBot. Check that it is still running.", - "plugins/social/client.js:Declined {}.", "plugins/social/client.js:Don't ask each time.#1", "plugins/social/client.js:Don't ask each time.#2", "plugins/social/client.js:Enter a 6-digit number.", "plugins/social/client.js:FlyBot cannot use the camera. Allow the camera for this page, or type the 6-digit number instead.", "plugins/social/client.js:In use in {} room{}: ", - "plugins/social/client.js:Invite a friend", - "plugins/social/client.js:Invite for {} copied with instructions.", - "plugins/social/client.js:Invite link for {} copied.", - "plugins/social/client.js:Invite link or code", "plugins/social/client.js:Invites need a newer Bot Social. The 6-digit number still works.#1", "plugins/social/client.js:Invites need a newer Bot Social. The 6-digit number still works.#2", "plugins/social/client.js:Invites need a newer Bot Social. The 6-digit number still works.#3", - "plugins/social/client.js:Joined {}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.{}", "plugins/social/client.js:Joining with that link…#1", "plugins/social/client.js:Joining with that link…#2", "plugins/social/client.js:Link ready", @@ -32,7 +22,6 @@ "plugins/social/client.js:Looking up that room…#1", "plugins/social/client.js:Looking up that room…#2", "plugins/social/client.js:Past rooms", - "plugins/social/client.js:Paste invite link or code", "plugins/social/client.js:Point the camera at a FlyBot room code.", "plugins/social/client.js:QR code for this room invite", "plugins/social/client.js:Remove this Bot from Friends' Bots and from your groups. This does not unfriend the owner.", @@ -40,16 +29,12 @@ "plugins/social/client.js:Remove this Bot#1", "plugins/social/client.js:Remove this Bot#2", "plugins/social/client.js:Removing…", - "plugins/social/client.js:Request sent to {}. They show up here once they accept.", "plugins/social/client.js:Scan to open this room", "plugins/social/client.js:Scanned a group link.", "plugins/social/client.js:Scanned an invite link.", - "plugins/social/client.js:Share ", "plugins/social/client.js:Social is not running: the plugin did not start. See Settings → Feedback.", "plugins/social/client.js:Social#1", "plugins/social/client.js:Social#2", - "plugins/social/client.js:Talk through ", - "plugins/social/client.js:Talks for you. Not shared: your friend can't use it unless you invite them to it.", "plugins/social/client.js:That is not a FlyBot room code. Ask for the 6-digit number instead.", "plugins/social/client.js:That is not an invite link. It looks like https://…/r/…", "plugins/social/client.js:That link cannot seat these Bots. Ask for a new one.", @@ -67,17 +52,11 @@ "plugins/social/client.js:This invite was already used. Ask your friend for a new one.", "plugins/social/client.js:This room only: ", "plugins/social/client.js:Too many tries for now. Wait a minute and try again.", - "plugins/social/client.js:Which of your Bots talks", - "plugins/social/client.js:Which of your Bots to share", "plugins/social/client.js:You already joined with that link using other Bots. Leave the group first to join with different ones.", - "plugins/social/client.js:Your friend gets this Bot only.", "plugins/social/client.js:Your own Bots stay shared. {} can share it again.", "plugins/social/client.js:the group", "plugins/social/client.js:the room", - "plugins/social/client.js:{} is now a friend.", - "plugins/social/client.js:{} shared {} with you.{}", "plugins/social/client.js:{} stays a friend: still shared through {}.", - "plugins/social/client.js:{} {} back in your list.", "plugins/timeline/client.js:Communication map: who sent requests to whom", "plugins/timeline/client.js:Copy report", "plugins/timeline/client.js:Copy this window as a Markdown report", diff --git a/patches/ds-bot/files/test/i18n-missing-entries.test.js b/patches/ds-bot/files/test/i18n-missing-entries.test.js index 015761596..e139da22f 100644 --- a/patches/ds-bot/files/test/i18n-missing-entries.test.js +++ b/patches/ds-bot/files/test/i18n-missing-entries.test.js @@ -82,7 +82,7 @@ test('the scan counts copy tables and copy props, not data', () => { test('the widened scan names every copy attribute and skips placeholder examples', () => { const source = [ "h(Button, { title: 'Archive this room', 'aria-label': 'Archive this room' })", - "h('input', { placeholder: 'Paste invite link or code' })", + "h('input', { placeholder: 'Type a room name' })", "h('input', { placeholder: 'https://social.example' })", "h('input', { placeholder: 'github, composio' })", "h(Picture, { alt: 'A picture of the room' })", @@ -93,7 +93,7 @@ test('the widened scan names every copy attribute and skips placeholder examples assert.deepEqual(keys, [ 'Archive this room', 'Archive this room', - 'Paste invite link or code', + 'Type a room name', 'A picture of the room', 'Type a name', 'Explains the row', diff --git a/patches/ds-bot/files/test/i18n-plugins.baseline.json b/patches/ds-bot/files/test/i18n-plugins.baseline.json index 7640c6bf8..81e8a6915 100644 --- a/patches/ds-bot/files/test/i18n-plugins.baseline.json +++ b/patches/ds-bot/files/test/i18n-plugins.baseline.json @@ -5,8 +5,6 @@ "plugins/social/client.js:Copied#1", "plugins/social/client.js:Copied#2", "plugins/social/client.js:Copy", - "plugins/social/client.js:Copy link", - "plugins/social/client.js:New link", "plugins/social/client.js:Your Bot Social handle", "plugins/social/client.js:Your Bots", "plugins/timeline/client.js:Close", diff --git a/patches/ds-bot/files/test/i18n-template-draws.baseline.json b/patches/ds-bot/files/test/i18n-template-draws.baseline.json index f034dbc7b..7d03d4805 100644 --- a/patches/ds-bot/files/test/i18n-template-draws.baseline.json +++ b/patches/ds-bot/files/test/i18n-template-draws.baseline.json @@ -5,18 +5,14 @@ "plugins/social/client.js:Auto-send my Bots' replies to {}", "plugins/social/client.js:Auto-send {} → room", "plugins/social/client.js:Auto-send {}'s room messages", - "plugins/social/client.js:Copy invite link for {}", "plugins/social/client.js:Invite grants {} only.", "plugins/social/client.js:Invite grants {} only. Revoke anytime in People with access.", - "plugins/social/client.js:Invite link for {}", "plugins/social/client.js:Remove {} from your list? {}", "plugins/social/client.js:Scanned {}.", "plugins/social/client.js:Scanned {}. Pick a Bot to join.", "plugins/social/client.js:Waiting for {} to let you in. If the group does not appear, press Join group to ask again.", - "plugins/social/client.js:You are {}", "plugins/social/client.js:Your Bots' replies to {} go out without asking you first. What you type is not affected.", "plugins/social/client.js:{} Send your message again: it starts a new chat.", - "plugins/social/client.js:{} failed: {}", "plugins/timeline/client.js:Could not copy the report: {}", "plugins/timeline/client.js:Last {}", "plugins/timeline/client.js:Looking back: window ends at {}.", diff --git a/plugins/social/client.js b/plugins/social/client.js index 0f5bea7a8..2a453ea08 100644 --- a/plugins/social/client.js +++ b/plugins/social/client.js @@ -3362,27 +3362,27 @@ window.__ModuleLoader__.load({ // One invite control for Add friend and a Bot's Sharing (#499): one button makes the link and copies // it; then the link shows with the same Copy link / Copy with instructions / New link, and every copy // note names the Bot. A plain render helper without hooks: each caller keeps its own state. - const INVITE_COPY_FAILED = 'Could not copy. Select the link and copy it by hand.' - const inviteCopied = (botName, withText) => (withText ? `Invite for ${botName} copied with instructions.` : `Invite link for ${botName} copied.`) + const inviteCopyFailed = () => tr('Could not copy. Select the link and copy it by hand.') + const inviteCopied = (botName, withText) => (withText ? tr('Invite for {bot} copied with instructions.', { bot: botName }) : tr('Invite link for {bot} copied.', { bot: botName })) // Call it straight from a click where possible, so the clipboard write keeps its permission. const copyInvite = (text, botName, withText = false) => { const clip = typeof navigator !== 'undefined' ? navigator.clipboard : undefined - if (!text || !clip?.writeText) return Promise.resolve({ tone: 'error', text: INVITE_COPY_FAILED }) - return Promise.resolve(clip.writeText(text)).then(() => ({ tone: 'ok', text: inviteCopied(botName, withText) }), () => ({ tone: 'error', text: INVITE_COPY_FAILED })) + if (!text || !clip?.writeText) return Promise.resolve({ tone: 'error', text: inviteCopyFailed() }) + return Promise.resolve(clip.writeText(text)).then(() => ({ tone: 'ok', text: inviteCopied(botName, withText) }), () => ({ tone: 'error', text: inviteCopyFailed() })) } function inviteControls({ botName, invite, busy, onMint, onCopy, onNew } = {}) { // The button names the Bot the link shares; a long name ends in an ellipsis instead of being clipped. if (!invite) { return h('div', { className: 'fs-line', 'data-flybot': 'invite-line' }, - h('button', { type: 'button', className: 'fs-btn', 'data-flybot': 'mint-invite', title: `Copy invite link for ${botName}`, style: { flex: '0 1 auto', minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis' }, disabled: busy, onClick: onMint }, `Copy invite link for ${botName}`)) + h('button', { type: 'button', className: 'fs-btn', 'data-flybot': 'mint-invite', title: tr('Copy invite link for {bot}', { bot: botName }), style: { flex: '0 1 auto', minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis' }, disabled: busy, onClick: onMint }, tr('Copy invite link for {bot}', { bot: botName }))) } // The link first, then Copy link as the one primary action; a new link is a quiet text button (#230). return h(Fragment, null, - h('input', { className: 'fs-input fs-invite-link', readOnly: true, value: invite.link, 'aria-label': `Invite link for ${botName}`, 'data-flybot': 'invite-link', onFocus: e => e.target.select?.(), onClick: e => e.target.select?.() }), + h('input', { className: 'fs-input fs-invite-link', readOnly: true, value: invite.link, 'aria-label': tr('Invite link for {bot}', { bot: botName }), 'data-flybot': 'invite-link', onFocus: e => e.target.select?.(), onClick: e => e.target.select?.() }), h('div', { className: 'fs-line fs-invite-actions' }, - h('button', { type: 'button', className: 'fs-btn fs-btn-primary fs-btn-fit', 'data-flybot': 'copy-link', onClick: () => onCopy(invite.link, false) }, 'Copy link'), - invite.text ? h('button', { type: 'button', className: 'fs-btn', 'data-flybot': 'copy-invite-text', onClick: () => onCopy(invite.text, true) }, 'Copy with instructions') : null, - h('button', { type: 'button', className: 'fs-link fs-invite-new', 'data-flybot': 'new-invite-link', disabled: busy, onClick: onNew }, 'New link'))) + h('button', { type: 'button', className: 'fs-btn fs-btn-primary fs-btn-fit', 'data-flybot': 'copy-link', onClick: () => onCopy(invite.link, false) }, tr('Copy link')), + invite.text ? h('button', { type: 'button', className: 'fs-btn', 'data-flybot': 'copy-invite-text', onClick: () => onCopy(invite.text, true) }, tr('Copy with instructions')) : null, + h('button', { type: 'button', className: 'fs-link fs-invite-new', 'data-flybot': 'new-invite-link', disabled: busy, onClick: onNew }, tr('New link')))) } // How long an accepted invite's result shows before Add friend closes on its own (#499). @@ -3441,7 +3441,7 @@ window.__ModuleLoader__.load({ const text = errorText(e) setStatus(text === ALREADY_HAVE ? { tone: 'info', text } - : { tone: 'error', text: /^This invite was already used/.test(text) ? text : `${label} failed: ${text}` }) + : { tone: 'error', text: /^This invite was already used/.test(text) ? text : tr('{what} failed: {why}', { what: label, why: text }) }) } finally { setBusy(false) } @@ -3468,7 +3468,7 @@ window.__ModuleLoader__.load({ if (r?.alreadyHave) { // Nothing changed unless a hidden or removed Bot really came back (#496). const back = (r.restored ?? []).map(bot => botWithOwner(bot.name, bot.owner)).filter(Boolean) - if (back.length) return `${back.join(' and ')} ${back.length > 1 ? 'are' : 'is'} back in your list.` + if (back.length) return tr('{bots} {verb} back in your list.', { bots: back.join(' and '), verb: back.length > 1 ? 'are' : 'is' }) const have = botWithOwner(r.botName, r.ownerName) // #1000: a re-accept completes the pair now, so the line says what the click did instead of // leaving the other direction silently absent. @@ -3477,15 +3477,15 @@ window.__ModuleLoader__.load({ } return { tone: 'info', text: have ? `You already have ${have}.` : ALREADY_HAVE } } - const who = r.inviterName ?? r.inviter ?? 'Your friend' + const who = r.inviterName ?? r.inviter ?? tr('Your friend') const shared = r.inviterBotName || r.sharedBot if (r.status === 'active') { // A join that brought no Bot says so instead of claiming one was shared, and stays open. if (shared) accepted = r const backNote = r.sharedBack ? ` ${sharedBackLine(r.sharedBackBotName)}` : '' - return shared ? `${who} shared ${shared} with you.${backNote}` : `Joined ${who}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.${backNote}` + return shared ? tr('{who} shared {bot} with you.{note}', { who, bot: shared, note: backNote }) : tr("Joined {who}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.{note}", { who, note: backNote }) } - return `Request sent to ${who}. They show up here once they accept.` + return tr('Request sent to {who}. They show up here once they accept.', { who }) }) // The result shows for a moment, then the panel closes on its own and opens the new friend's // Bot when it is already listed: no second click on Done (#499). @@ -3500,7 +3500,7 @@ window.__ModuleLoader__.load({ } const respond = (item, decision) => run(decision === 'accept' ? 'Accepting' : 'Declining', async () => { await call('social/respond', { relationshipId: item.relationshipId, decision }) - return decision === 'accept' ? `${item.name ?? item.handle} is now a friend.` : `Declined ${item.name ?? item.handle}.` + return decision === 'accept' ? tr('{name} is now a friend.', { name: item.name ?? item.handle }) : tr('Declined {name}.', { name: item.name ?? item.handle }) }) const incoming = overview?.incoming ?? [] const outgoing = overview?.outgoing ?? [] @@ -3510,31 +3510,31 @@ window.__ModuleLoader__.load({ return h('div', { className: 'bt-social-add', 'data-flybot': 'add-friend' }, h('div', { className: 'fs-face-head' }, h('div', { className: 'fs-label fs-label-plain' }, tr('Add friend'))), - me ? h('div', { className: 'fs-hint', 'data-flybot': 'my-handle', style: { padding: '0 10px' } }, `You are ${me}`) : null, - h('div', { className: 'fs-label', 'data-flybot': 'accept-heading' }, 'Accept an invite'), + me ? h('div', { className: 'fs-hint', 'data-flybot': 'my-handle', style: { padding: '0 10px' } }, tr('You are {me}', { me })) : null, + h('div', { className: 'fs-label', 'data-flybot': 'accept-heading' }, tr('Accept an invite')), h('form', { onSubmit: join, className: 'fs-card bt-social-join', 'data-flybot': 'accept-group' }, // The paste box takes the full width on its own row and wraps, so a whole link is readable (#343, // #499). Typing clears an error that no longer applies; Enter accepts, as in a one-line box. h('textarea', { - className: 'fs-input fs-paste', rows: 2, style: { width: '100%' }, value: code, spellCheck: false, placeholder: 'Paste invite link or code', 'aria-label': 'Invite link or code', + className: 'fs-input fs-paste', rows: 2, style: { width: '100%' }, value: code, spellCheck: false, placeholder: tr('Paste invite link or code'), 'aria-label': tr('Invite link or code'), onChange: (e) => { setCode(e.target.value); if (status?.tone === 'error') setStatus(null) }, onKeyDown: (e) => { if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent?.isComposing) { e.preventDefault(); e.currentTarget?.form?.requestSubmit?.() } }, }), // Accepting grants only the invited Bot to you. The Bot you talk through is not shared, so // there is nothing to pick with one Bot (#228). - mine.length > 1 ? h('label', { className: 'fs-line fs-hint fs-join-as', 'data-flybot': 'join-as', title: "Talks for you. Not shared: your friend can't use it unless you invite them to it." }, - h('span', { className: 'fs-join-as-label', 'data-flybot': 'talk-through' }, 'Talk through '), - h('select', { className: 'fs-input', value: joiner, 'aria-label': 'Which of your Bots talks', onChange: e => setJoiner(e.target.value) }, + mine.length > 1 ? h('label', { className: 'fs-line fs-hint fs-join-as', 'data-flybot': 'join-as', title: tr("Talks for you. Not shared: your friend can't use it unless you invite them to it.") }, + h('span', { className: 'fs-join-as-label', 'data-flybot': 'talk-through' }, tr('Talk through ')), + h('select', { className: 'fs-input', value: joiner, 'aria-label': tr('Which of your Bots talks'), onChange: e => setJoiner(e.target.value) }, mine.map(bot => h('option', { key: bot.id, value: bot.id }, bot.name)))) : null, h('div', { className: 'fs-line' }, h('button', { type: 'submit', className: 'fs-btn', disabled: busy || !code.trim() }, tr('Accept invite')))), - h('div', { className: 'fs-label', 'data-flybot': 'invite-heading' }, 'Invite a friend'), + h('div', { className: 'fs-label', 'data-flybot': 'invite-heading' }, tr('Invite a friend')), h('div', { className: 'fs-card', 'data-flybot': 'invite-group' }, // Which Bot the link shares is a labelled picker on its own line, not a bare `C…`; a name too long // for the sidebar is whole in the tooltip and in the button's tooltip below (#343). - mine.length > 1 ? h('label', { className: 'fs-line fs-hint fs-join-as', 'data-flybot': 'share-as', title: 'Your friend gets this Bot only.' }, - h('span', { className: 'fs-join-as-label' }, 'Share '), - h('select', { className: 'fs-input', value: sharing, title: shareName, 'aria-label': 'Which of your Bots to share', 'data-flybot': 'share-bot', onChange: e => { setSharing(e.target.value); setMade(null) } }, + mine.length > 1 ? h('label', { className: 'fs-line fs-hint fs-join-as', 'data-flybot': 'share-as', title: tr('Your friend gets this Bot only.') }, + h('span', { className: 'fs-join-as-label' }, tr('Share ')), + h('select', { className: 'fs-input', value: sharing, title: shareName, 'aria-label': tr('Which of your Bots to share'), 'data-flybot': 'share-bot', onChange: e => { setSharing(e.target.value); setMade(null) } }, mine.map(bot => h('option', { key: bot.id, value: bot.id }, bot.name)))) : null, // The same invite control as the Bot's Sharing (#499). inviteControls({ botName: made?.botName || shareName, invite: made, busy, onMint: () => mint(true), onCopy: copyMade, onNew: () => mint(false) })), diff --git a/plugins/social/test/add-friend-i18n.test.js b/plugins/social/test/add-friend-i18n.test.js new file mode 100644 index 000000000..15c4ff9d9 --- /dev/null +++ b/plugins/social/test/add-friend-i18n.test.js @@ -0,0 +1,132 @@ +// #3114 cut 22: the Add friend panel — both groups, the paste box, both Bot pickers, the invite +// controls it shares with a Bot's Sharing page and the result lines — drew twenty-five positions +// as bare English in a zh window. A zh window reads the dictionary's words, a window whose host +// has no translator keeps today's English word for word, and the three baselines lose these pins. +import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' +import { test } from 'node:test' +import { runInNewContext } from 'node:vm' +import { DICTIONARY } from '../../../core/src/client/i18n.js' +const zh = DICTIONARY.zh +// `t` answers with the Chinese dictionary for a key it carries and echoes the key otherwise. +const translator = (text, params) => { + const translated = Object.hasOwn(zh, text) ? zh[text] : String(text) + return params ? translated.replace(/\{(\w+)\}/g, (match, name) => (name in params ? String(params[name]) : match)) : translated +} +const zhWindow = { t: translator, slots: { register: () => () => {} }, call: async () => ({}) } +const bareWindow = { slots: { register: () => () => {} }, call: async () => ({}) } +// The client registers its factory on `window`; the sandbox is the global the plugin reads +// `__flybot__` off at render time. `states` seeds the useState calls in order: friend list, paste +// box, status line, busy, both pickers, my handle, and the invite just made. +function loadApp(flybot, states = []) { + const registered = [] + const sandbox = { window: { __ModuleLoader__: { load: entry => registered.push(entry) } }, console, setTimeout, clearTimeout } + sandbox.globalThis = sandbox + sandbox.__flybot__ = flybot + runInNewContext(readFileSync(new URL('../client.js', import.meta.url), 'utf8'), sandbox) + let seed = 0 + const createElement = (type, props, ...children) => ({ type, props: props ?? {}, children: children.flat() }) + return registered[0].factory(() => ({ + createElement, Fragment: 'F', useEffect() {}, + useState: value => [seed < states.length ? states[seed++] : value, () => {}], + useRef: value => ({ current: value }), + })) +} +// Every string the tree paints, in draw order: Bot names included, so English shows in the list. +function draw(node, all = []) { + if (!node || typeof node !== 'object') return all + if (typeof node.type === 'function') return draw(node.type(node.props), all) + for (const child of node.children ?? []) { if (typeof child === 'string') { if (child.trim()) all.push(child) } else draw(child, all) } + return all +} +const byId = (node, id) => { + if (!node || typeof node !== 'object') return undefined + const one = typeof node.type === 'function' ? node.type(node.props) : node + if (one?.props?.['data-flybot'] === id) return one + for (const child of one?.children ?? []) { const hit = byId(child, id); if (hit) return hit } + return undefined +} +const bots = [{ id: 'b1', name: 'Mine', isMain: true }, { id: 'b2', name: 'Helper' }] +const overview = { incoming: [], outgoing: [] } +const made = { link: 'https://social.example/r/1', text: 'Hello', botName: 'Mine' } +const states = (invite = null, me = '') => [overview, '', null, false, bots, 'b1', 'b1', me, invite] +test('#3114 cut 22: the Add friend panel speaks the window’s language', () => { + const nodes = loadApp(zhWindow, states(null, 'you@home')).AddFriend({ actions: {}, onChange: () => {} }) + const drawn = draw(nodes) + assert.ok(!drawn.includes('Accept an invite'), 'the English "Accept an invite" is still drawn') + assert.deepEqual(drawn, [ + '添加好友', '你是 you@home', '接受邀请', '通过', 'Mine', 'Helper', '接受邀请', '邀请朋友', '分享', 'Mine', 'Helper', '复制给 Mine 的邀请链接', + ]) + // The paste box, both pickers and the tooltips are copy attributes, not painted text. + const box = byId(nodes, 'accept-group').children.find(child => child.props?.placeholder) + assert.deepEqual([box.props.placeholder, box.props['aria-label']], ['粘贴邀请链接或邀请码', '邀请链接或邀请码']) + assert.equal(byId(nodes, 'join-as').props.title, '这个 Bot 替你说话,不会被共享;除非你邀请,否则你的朋友用不了它。') + assert.equal(byId(nodes, 'share-bot').props['aria-label'], '分享哪个 Bot') + assert.equal(byId(nodes, 'share-as').props.title, '你的朋友只会拿到这个 Bot。') +}) + +test('#3114 cut 22: the invite controls speak the window’s language', () => { + const nodes = loadApp(zhWindow, states(made)).AddFriend({ actions: {}, onChange: () => {} }) + // A made link draws its own name and the three buttons, then every copy receipt follows it. + assert.equal(byId(nodes, 'invite-link').props['aria-label'], 'Mine 的邀请链接', 'the English Invite link for {bot} is still drawn') + assert.deepEqual(draw(nodes).slice(-3), ['复制链接', '连说明一起复制', '新链接']) + // Before a link exists the one button is named after the Bot, in its tooltip and its text. + const fresh = loadApp(zhWindow, states()).AddFriend({ actions: {}, onChange: () => {} }) + assert.equal(byId(fresh, 'mint-invite').props.title, '复制给 Mine 的邀请链接', 'the English Copy invite link for {bot} is still drawn') + assert.equal(byId(fresh, 'mint-invite').children[0], '复制给 Mine 的邀请链接') + // Copy link and New link are dictionary entries already: reused, never added a second time. + assert.deepEqual([zh['Copy link'], zh['New link']], ['复制链接', '新链接']) +}) + +test('#3114 cut 22: no translator keeps today’s English in the Add friend panel', () => { + // A host with no translator keeps the English it drew before this change, character for + // character — `tr()` replaces a string only when the host answers for it. + const nodes = loadApp(bareWindow, states(made, 'you@home')).AddFriend({ actions: {}, onChange: () => {} }) + assert.deepEqual(draw(nodes), [ + 'Add friend', 'You are you@home', 'Accept an invite', 'Talk through ', 'Mine', 'Helper', 'Accept invite', + 'Invite a friend', 'Share ', 'Mine', 'Helper', 'Copy link', 'Copy with instructions', 'New link', + ]) + const box = byId(nodes, 'accept-group').children.find(child => child.props?.placeholder) + assert.deepEqual([box.props.placeholder, box.props['aria-label'], byId(nodes, 'invite-link').props['aria-label']], ['Paste invite link or code', 'Invite link or code', 'Invite link for Mine']) + assert.equal(byId(nodes, 'share-bot').props['aria-label'], 'Which of your Bots to share') + assert.equal(byId(nodes, 'join-as').props.title, "Talks for you. Not shared: your friend can't use it unless you invite them to it.") + assert.equal(byId(loadApp(bareWindow, states()).AddFriend({ actions: {} }), 'mint-invite').props.title, 'Copy invite link for Mine') +}) + +// The baselines may only shrink, and an entry leaves when its zh key lands; read as shipped. +const pinned = [ + ['i18n-missing-entries.baseline.json', [ + 'Accept an invite', 'Copy with instructions', 'Could not copy. Select the link and copy it by hand.#1', + 'Could not copy. Select the link and copy it by hand.#2', 'Declined {}.', 'Invite a friend', + 'Invite for {} copied with instructions.', 'Invite link for {} copied.', 'Invite link or code', + "Joined {}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.{}", 'Paste invite link or code', 'Request sent to {}. They show up here once they accept.', + 'Share ', 'Talk through ', "Talks for you. Not shared: your friend can't use it unless you invite them to it.", + 'Which of your Bots talks', 'Which of your Bots to share', 'Your friend gets this Bot only.', + '{} is now a friend.', '{} shared {} with you.{}', '{} {} back in your list.', + ]], + ['i18n-template-draws.baseline.json', ['Copy invite link for {}', 'Invite link for {}', 'You are {}', '{} failed: {}']], + ['i18n-plugins.baseline.json', ['Copy link', 'New link']], +] +const entriesOf = file => JSON.parse(readFileSync(new URL(`../../../core/test/${file}`, import.meta.url), 'utf8')).entries + +test('#3114 cut 22: the baselines lose these draws and the dictionary gains the keys', () => { + for (const [file, keys] of pinned) { + const entries = entriesOf(file) + const still = keys.map(key => `plugins/social/client.js:${key}`).filter(id => entries.includes(id)) + assert.deepEqual(still, [], `${file.replace('.baseline.json', '')} still pins ${still[0]}`) + } + // The three baselines shrink by exactly these draws and nothing else does: the ratchet's numbers. + assert.deepEqual([entriesOf('i18n-plugins.baseline.json').length, entriesOf('i18n-template-draws.baseline.json').length, entriesOf('i18n-missing-entries.baseline.json').length], [14, 21, 94]) + // Every new key is the dictionary's, and each answers with Chinese. + for (const key of [ + 'Accept an invite', 'Invite a friend', 'Paste invite link or code', + 'Invite link or code', 'Talk through ', 'Which of your Bots talks', + "Talks for you. Not shared: your friend can't use it unless you invite them to it.", 'Share ', 'Which of your Bots to share', + 'Your friend gets this Bot only.', 'You are {me}', 'Copy invite link for {bot}', + 'Invite link for {bot}', 'Copy with instructions', 'Invite for {bot} copied with instructions.', + 'Invite link for {bot} copied.', 'Could not copy. Select the link and copy it by hand.', '{bots} {verb} back in your list.', + '{who} shared {bot} with you.{note}', "Joined {who}'s invite, but their Bot hasn't loaded yet. It shows in your list when it does; if not, accept the link again.{note}", 'Request sent to {who}. They show up here once they accept.', + '{name} is now a friend.', 'Declined {name}.', '{what} failed: {why}', + 'Your friend', + ]) assert.ok(zh[key], `expected ${zh[key]} (${key})`) +}) diff --git a/plugins/social/test/sharing-page-i18n.test.js b/plugins/social/test/sharing-page-i18n.test.js index 9dc0af583..9b5c056a3 100644 --- a/plugins/social/test/sharing-page-i18n.test.js +++ b/plugins/social/test/sharing-page-i18n.test.js @@ -143,9 +143,9 @@ test('#3114 cut 20: the three baselines lose these draws', () => { const still = keys.map(key => `plugins/social/client.js:${key}`).filter(id => entries.includes(id)) assert.deepEqual(still, [], `${file.replace('.baseline.json', '')} still pins ${still[0]}`) } - // The two baselines shrink by exactly these draws and nothing else does: the third baseline is - // untouched at 16, and a later cut that moves the other two totals moves these numbers with it. - assert.deepEqual([entriesOf('i18n-plugins.baseline.json').length, entriesOf('i18n-template-draws.baseline.json').length, entriesOf('i18n-missing-entries.baseline.json').length], [16, 25, 115]) + // The baselines shrink by exactly these draws and nothing else does: the totals are the ratchet's + // numbers, and a later cut that moves them moves these numbers with it. + assert.deepEqual([entriesOf('i18n-plugins.baseline.json').length, entriesOf('i18n-template-draws.baseline.json').length, entriesOf('i18n-missing-entries.baseline.json').length], [14, 21, 94]) // A host with no translator keeps the English it drew before this change, character for // character — `tr()` replaces a string only when the host answers for it. diff --git a/plugins/social/test/social.test.js b/plugins/social/test/social.test.js index 9bdeec562..777a32fa6 100644 --- a/plugins/social/test/social.test.js +++ b/plugins/social/test/social.test.js @@ -8486,7 +8486,7 @@ test('#1033: only the same home\'s Bot is named as the link that keeps the frien test('#138: join success copy names the person and the Bot', () => { const src = readFileSync(new URL('../client.js', import.meta.url), 'utf8') - assert.match(src, /shared \$\{shared\} with you/) + assert.match(src, /shared \{bot\} with you/) assert.match(src, /Talk through /) // #228: the talk-through tooltip says plainly that Bot is not shared; nothing implies a grant back. assert.match(src, /Talks for you\. Not shared: your friend can't use it unless you invite them to it\./)