Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3114-sharing-rooms-zh.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A Bot’s Sharing page now reads in the window’s language where it still did not: the hint above the invite link (with and without the Revoke tail) and the rooms each grant reaches, including the “+N more” count and the room-only line ([#3114](https://github.com/ThinkFlowLab/FlyBot/issues/3114)).
9 changes: 8 additions & 1 deletion core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,14 @@ var HOST_ZH = {
"QR code for this room invite": "这个房间邀请的二维码",
"Scan to open this room": "扫码打开这个房间",
"Anyone with the link can join while the room is open.": "只要房间还开着,拿到链接的人都能加入。",
"Bot Social did not send an invite. Try again.": "Bot Social 没有发来邀请,请重试。"
"Bot Social did not send an invite. Try again.": "Bot Social 没有发来邀请,请重试。",
// #3114 cut 26: the invite hint on a Bot's Sharing page and the rooms a grant reaches.
"Invite grants {bot} only.": "邀请只把 {bot} 授权给对方。",
"Invite grants {bot} only. Revoke anytime in People with access.": "邀请只把 {bot} 授权给对方。随时可以在「可访问的人」里撤销。",
"In use in {n} room: ": "正在 {n} 个房间里使用:",
"In use in {n} rooms: ": "正在 {n} 个房间里使用:",
"This room only: ": "只在这个房间使用:",
" +{n} more": ",还有 {n} 个"
};
Object.assign(ZH, HOST_ZH);
var fill = (text2, params) => params ? text2.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match) : text2;
Expand Down
7 changes: 7 additions & 0 deletions core/src/client/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,13 @@ const HOST_ZH = {
'Scan to open this room': '扫码打开这个房间',
'Anyone with the link can join while the room is open.': '只要房间还开着,拿到链接的人都能加入。',
'Bot Social did not send an invite. Try again.': 'Bot Social 没有发来邀请,请重试。',
// #3114 cut 26: the invite hint on a Bot's Sharing page and the rooms a grant reaches.
'Invite grants {bot} only.': '邀请只把 {bot} 授权给对方。',
'Invite grants {bot} only. Revoke anytime in People with access.': '邀请只把 {bot} 授权给对方。随时可以在「可访问的人」里撤销。',
'In use in {n} room: ': '正在 {n} 个房间里使用:',
'In use in {n} rooms: ': '正在 {n} 个房间里使用:',
'This room only: ': '只在这个房间使用:',
' +{n} more': ',还有 {n} 个',
}
Object.assign(ZH, HOST_ZH)

Expand Down
3 changes: 0 additions & 3 deletions core/test/i18n-missing-entries.baseline.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
{
"version": 1,
"entries": [
"plugins/social/client.js: +{} more",
"plugins/social/client.js:Chat paused",
"plugins/social/client.js:Could not reach FlyBot. Check that it is still running.",
"plugins/social/client.js:In use in {} room{}: ",
"plugins/social/client.js:Past rooms",
"plugins/social/client.js:Remove this Bot from Friends' Bots and from your groups. This does not unfriend the owner.",
"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:The FlyBot host did not answer (HTTP {}). Reload the page; if this keeps happening, restart FlyBot web.",
"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:the room",
"plugins/timeline/client.js:Communication map: who sent requests to whom",
"plugins/timeline/client.js:Copy report",
Expand Down
2 changes: 0 additions & 2 deletions core/test/i18n-template-draws.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"entries": [
"plugins/social/client.js:Auto-send {} → room",
"plugins/social/client.js:Auto-send {}'s room messages",
"plugins/social/client.js:Invite grants {} only.",
"plugins/social/client.js:Invite grants {} only. Revoke anytime in People with access.",
"plugins/social/client.js:{} Send your message again: it starts a new chat.",
"plugins/timeline/client.js:Could not copy the report: {}",
"plugins/timeline/client.js:Last {}",
Expand Down
9 changes: 8 additions & 1 deletion patches/ds-bot/0001-core-fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ 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,40 @@ const HOST_ZH = {
@@ -905,6 +905,47 @@ 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 不能列出文件夹',
Expand Down Expand Up @@ -2093,6 +2093,13 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js
+ 'Scan to open this room': '扫码打开这个房间',
+ 'Anyone with the link can join while the room is open.': '只要房间还开着,拿到链接的人都能加入。',
+ 'Bot Social did not send an invite. Try again.': 'Bot Social 没有发来邀请,请重试。',
+ // #3114 cut 26: the invite hint on a Bot's Sharing page and the rooms a grant reaches.
+ 'Invite grants {bot} only.': '邀请只把 {bot} 授权给对方。',
+ 'Invite grants {bot} only. Revoke anytime in People with access.': '邀请只把 {bot} 授权给对方。随时可以在「可访问的人」里撤销。',
+ 'In use in {n} room: ': '正在 {n} 个房间里使用:',
+ 'In use in {n} rooms: ': '正在 {n} 个房间里使用:',
+ 'This room only: ': '只在这个房间使用:',
+ ' +{n} more': ',还有 {n} 个',
}
Object.assign(ZH, HOST_ZH)

Expand Down
11 changes: 9 additions & 2 deletions patches/ds-bot/0008-client-bundle.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ 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,44 @@ var HOST_ZH = {
@@ -951,10 +951,51 @@ var HOST_ZH = {
"The model wrote nothing": "模型没有输出内容",
"Write the entry to save.": "请写下要保存的内容。",
"This DeepSeek Harness has no folder chooser": "这个 DeepSeek Harness 没有文件夹选择窗口",
Expand Down Expand Up @@ -1356,7 +1356,14 @@ diff --git a/client.js b/client.js
+ "QR code for this room invite": "这个房间邀请的二维码",
+ "Scan to open this room": "扫码打开这个房间",
+ "Anyone with the link can join while the room is open.": "只要房间还开着,拿到链接的人都能加入。",
+ "Bot Social did not send an invite. Try again.": "Bot Social 没有发来邀请,请重试。"
+ "Bot Social did not send an invite. Try again.": "Bot Social 没有发来邀请,请重试。",
+ // #3114 cut 26: the invite hint on a Bot's Sharing page and the rooms a grant reaches.
+ "Invite grants {bot} only.": "邀请只把 {bot} 授权给对方。",
+ "Invite grants {bot} only. Revoke anytime in People with access.": "邀请只把 {bot} 授权给对方。随时可以在「可访问的人」里撤销。",
+ "In use in {n} room: ": "正在 {n} 个房间里使用:",
+ "In use in {n} rooms: ": "正在 {n} 个房间里使用:",
+ "This room only: ": "只在这个房间使用:",
+ " +{n} more": ",还有 {n} 个"
};
Object.assign(ZH, HOST_ZH);
-var fill = (text, params) => params ? text.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match) : text;
Expand Down
3 changes: 0 additions & 3 deletions patches/ds-bot/files/test/i18n-missing-entries.baseline.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
{
"version": 1,
"entries": [
"plugins/social/client.js: +{} more",
"plugins/social/client.js:Chat paused",
"plugins/social/client.js:Could not reach FlyBot. Check that it is still running.",
"plugins/social/client.js:In use in {} room{}: ",
"plugins/social/client.js:Past rooms",
"plugins/social/client.js:Remove this Bot from Friends' Bots and from your groups. This does not unfriend the owner.",
"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:The FlyBot host did not answer (HTTP {}). Reload the page; if this keeps happening, restart FlyBot web.",
"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:the room",
"plugins/timeline/client.js:Communication map: who sent requests to whom",
"plugins/timeline/client.js:Copy report",
Expand Down
2 changes: 0 additions & 2 deletions patches/ds-bot/files/test/i18n-template-draws.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"entries": [
"plugins/social/client.js:Auto-send {} → room",
"plugins/social/client.js:Auto-send {}'s room messages",
"plugins/social/client.js:Invite grants {} only.",
"plugins/social/client.js:Invite grants {} only. Revoke anytime in People with access.",
"plugins/social/client.js:{} Send your message again: it starts a new chat.",
"plugins/timeline/client.js:Could not copy the report: {}",
"plugins/timeline/client.js:Last {}",
Expand Down
10 changes: 7 additions & 3 deletions plugins/social/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@
const roomHint = (kind, rooms, skip) => {
const rows = roomList(rooms, skip)
if (!rows.length) return null
const head = kind === 'use' ? `In use in ${rows.length} room${rows.length === 1 ? '' : 's'}: ` : 'This room only: '
const head = kind === 'use'
? tr(rows.length === 1 ? 'In use in {n} room: ' : 'In use in {n} rooms: ', { n: rows.length })
: tr('This room only: ')
const build = (count, clip) => {
const pick = rows.slice(0, count).map(row => (clip ? clipRoom(row.label) : row.label))
const rest = rows.length - pick.length
return head + pick.join(', ') + (rest > 0 ? ` +${rest} more` : '')
return head + pick.join(', ') + (rest > 0 ? tr(' +{n} more', { n: rest }) : '')
}
const top = Math.min(ROOM_HINT_NAMES, rows.length)
// Short lists print whole names; a long-lived share falls back to clipped names so the count still shows.
Expand Down Expand Up @@ -720,7 +722,7 @@
function qrRsGenerator(degree) {
let poly = [1]
for (let i = 0; i < degree; i += 1) {
const next = new Array(poly.length + 1).fill(0)

Check warning on line 725 in plugins/social/client.js

View workflow job for this annotation

GitHub Actions / plugins (social)

unicorn(no-new-array)

Do not use `new Array(singleArgument)`.
for (let j = 0; j < poly.length; j += 1) {
next[j] ^= poly[j]
next[j + 1] ^= qrMul(poly[j], QR_GF_EXP[i])
Expand All @@ -731,7 +733,7 @@
}
function qrRsRemainder(bytes, degree) {
const gen = qrRsGenerator(degree)
const res = new Array(bytes.length + degree).fill(0)

Check warning on line 736 in plugins/social/client.js

View workflow job for this annotation

GitHub Actions / plugins (social)

unicorn(no-new-array)

Do not use `new Array(singleArgument)`.
for (let i = 0; i < bytes.length; i += 1) res[i] = bytes[i]
for (let i = 0; i < bytes.length; i += 1) {
const factor = res[i]
Expand Down Expand Up @@ -3857,7 +3859,9 @@
const copy = (text, withText) => { void copyInvite(text, bot.name, withText).then(setNote) }
// Revoke is mentioned once People with access has someone to revoke (#499).
return h('div', { className: 'fs fs-card', 'data-flybot': 'invite-to-bot' },
h('div', { className: 'fs-hint', 'data-flybot': 'invite-hint-sharing' }, revocable ? `Invite grants ${bot.name} only. Revoke anytime in People with access.` : `Invite grants ${bot.name} only.`),
h('div', { className: 'fs-hint', 'data-flybot': 'invite-hint-sharing' }, revocable
? tr('Invite grants {bot} only. Revoke anytime in People with access.', { bot: bot.name })
: tr('Invite grants {bot} only.', { bot: bot.name })),
inviteControls({ botName: bot.name, invite, busy, onMint: () => create(true), onCopy: copy, onNew: () => create(false) }),
note ? h('div', { className: 'fs-status', role: 'status', 'data-tone': note.tone }, note.text) : null)
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/social/test/add-friend-i18n.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ test('#3114 cut 22: the baselines lose these draws and the dictionary gains the
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], [12, 14, 51])
assert.deepEqual([entriesOf('i18n-plugins.baseline.json').length, entriesOf('i18n-template-draws.baseline.json').length, entriesOf('i18n-missing-entries.baseline.json').length], [12, 12, 48])
// 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',
Expand Down
2 changes: 1 addition & 1 deletion plugins/social/test/friend-settings-i18n.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ test('#3114 cut 23: the two baselines lose these draws and nothing else', () =>
entriesOf('i18n-plugins.baseline.json').length,
entriesOf('i18n-template-draws.baseline.json').length,
entriesOf('i18n-missing-entries.baseline.json').length,
], [12, 14, 51])
], [12, 12, 48])
// People with access is reused, never added twice; the same for the friend's own fallback name.
assert.equal(zh['Your friend'], '你的朋友')
})
2 changes: 1 addition & 1 deletion plugins/social/test/sharing-page-i18n.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ test('#3114 cut 20: the three baselines lose these draws', () => {
}
// 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], [12, 14, 51])
assert.deepEqual([entriesOf('i18n-plugins.baseline.json').length, entriesOf('i18n-template-draws.baseline.json').length, entriesOf('i18n-missing-entries.baseline.json').length], [12, 12, 48])

// 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.
Expand Down
Loading
Loading