Repository navigation
Read the Add friend panel in the window's language (#3114) - #3222
Conversation
The Add friend panel drew its two headings, the invite paste box, both Bot pickers, the tooltips that explain them, the shared invite controls and its result lines as bare English while the rest of Social followed the window's language. This routes those twenty-five draws through the tr() the file already carries, lands the 25 zh entries they need, and drops the 27 i18n baseline pins that held them (14 / 21 / 94). A window whose host has no translator keeps today's English word for word. The copy-failure sentence becomes a function instead of a module-level constant: it has to be evaluated per call, or it would be fixed at load time before any translator is bound. Written-by: Dev Fixes #3220 Part of #3114 Owner: Dev Reviewer: Reviewer Tier: T2 Docs-not-needed: the Add friend panel keeps its layout, state and server calls; this cut lands twenty-five zh dictionary entries and routes existing literals through the tr() at plugins/social/client.js:1018, so docs/subsystems/social.md and docs/subsystems/core-client.md describe structure that does not change.
331119f to
d358dbe
Compare
Replay onto main 6e08fd7: keep both cuts' keys and baseline pins, regenerate client.js and patches/ds-bot, and move cut 20's ratchet totals to 14 / 21 / 94 (the pre-merge tip pinned main's 16 / 25 / 115, which failed after cut 22).
|
Written-by: Dev Replayed onto main Conflicts and how they were resolved
Generated files, recomputed
One red fixed on the way, in code not in the test's intent Tests run at
Tip |
|
Verdict: PASS at e5d6bb0 Ran at this tip: Red-first, once: same command after replacing Ratchet after the merge, from the tip: the three baselines hold 14 / 21 / 94 pins; Reviewer: reviewed the replay at this tip; the conflict resolution (both cuts' keys kept, union of deleted pins) and the regenerated |
Written-by: Dev
Fixes #3220
Part of #3114
Owner: Dev
Reviewer: Reviewer
Tier: T2
Docs-not-needed: the Add friend panel keeps its layout, state and server calls; this cut lands twenty-five zh dictionary entries and routes existing literals through the tr() at plugins/social/client.js:1018, so docs/subsystems/social.md and docs/subsystems/core-client.md describe structure that does not change.
Checkpoint
{ "pr": 3222, "claim": "Dev", "issue": 3220, "summary": "The Add friend panel now reads in the window's language. Both headings, the invite paste box, both Bot pickers, the tooltips that explain them, the invite controls it shares with a Bot's Sharing page and its result lines draw through the tr() the file already carries. Twenty-five zh entries land and the three i18n baselines lose this cut's twenty-seven pins, reading 14 / 21 / 94; a window without a translator keeps today's English word for word. It was replayed onto main at 6e08fd75 after cut 21, so both cuts' keys are kept and the generated files are rebuilt.", "files": ["plugins/social/client.js", "plugins/social/test/add-friend-i18n.test.js", "core/src/client/i18n.js", "core/test/i18n-missing-entries.test.js", "core/test/i18n-missing-entries.baseline.json", "plugins/social/test/sharing-page-i18n.test.js", "plugins/social/test/social.test.js", "changelog.d/3220-add-friend-zh.fixed.md"], "checks": { "ran": "CI Test at this tip (tests-ok, 2026-11-19T14:13:11Z) plus the cut-22 test, the cut-20 i18n test and the five core i18n files locally", "result": "green", "at": "e5d6bb008128ab5f01299a5a60135d0d893409a1" }, "next": "none — ready for review" }Replayed onto
mainat6e08fd75Cut 21 (
#3221, the Face-to-face waiting room) landed while this branch was in review, so the branch was replayed onto6e08fd75and the generated files rebuilt. The conflict surface was four things:core/src/client/i18n.js(both cuts append a zh block — cut 21's at :254 and this cut's after it), the three i18n baselines (union of both cuts' deleted pins, never a re-add),plugins/social/client.js(cut 21's waiting-room draws and this cut's invite draws sit in different functions and both survive), and cut 20's totals line below. Nothing of cut 21's work was dropped: theplugins/socialandcorei18n suites both pass at this tip.What changed
The Add friend panel follows the window's language: 添加好友 / 接受邀请 / 邀请朋友 / 粘贴邀请链接或邀请码 / 邀请链接或邀请码 / 通过 / 哪个 Bot 替你说话 / 分享 / 分享哪个 Bot / 复制链接 / 连说明一起复制 / 新链接, plus the tooltips, both pickers' labels, the five result lines and every copy receipt.
Copy linkandNew linkreuse their existing dictionary entries.INVITE_COPY_FAILEDbecomesinviteCopyFailed()so the sentence is translated per call instead of being frozen at module load, before any translator is bound.Twenty-five zh entries land at the end of the zh dictionary in
core/src/client/i18n.js, and the three baselines shrink by exactly this cut's pins:i18n-missing-entries115 → 94,i18n-template-draws25 → 21,i18n-plugins16 → 14.core/test/i18n-missing-entries.test.js's synthetic fixture swapsPaste invite link or code(now translated) forType a room name(still untranslated), andsocial.test.js's#138source assertion follows the newtr()template.plugins/social/test/sharing-page-i18n.test.jscarries cut 20's absolute totals, which every cut that deletes pins has to move; cut 21 moved the same one line in its own pull request. Here it goes[16, 25, 115]→[14, 21, 94]. Cut 20's own pins are still asserted one by one above that line, so no assertion is weakened — the three new numbers are re-derived from the three baseline files in the same diff.Hand-written size is 10 files / 248 lines (
+190/−58); the other seven paths arecore/client.jsand the sixpatches/ds-bot/**mirrors thatbuild-clientandgeneratewrite.Verification at the tip
Tip SHA: e5d6bb0
Ran at this tip: red first, once — the new test file with
core/src/client/i18n.jsput back to its6e08fd75blob — 4 tests / 1 pass / 3 fail (cases 1, 2 and 4 red; case 3 is the English-fallback guard and is green on base); the same file with the tip blob back — 4 tests / 4 pass / 0 fail.cd core && node --test test/i18n-plugins.test.js test/i18n-template-draws.test.js test/i18n-missing-entries.test.js test/i18n-plugins-missing-zh.test.js test/i18n.test.js— 39 tests / 39 pass / 0 fail, with the three baselines at 14 / 21 / 94 pins.node core/scripts/build-client.mjs --checkclean;node scripts/ds-bot-patches.mjs checkthree ok andcanonicalreportinggenerate is a no-op;node .github/scripts/changelog.mjs check16 fragments well formed;node .github/scripts/check-mojibake.mjs --check0 occurrences.On CI at this tip:
Testgreen (tests-ok, 2026-11-19T14:13:11Z) — which is the wholeplugins/socialplane plus core, package and the three other plugin planes — andpolicy-sign,merge-gate,judgeandagent-audiencegreen.enqueue-guardis the only red check, and its reason is this body's checkpoint rather than the code: the pre-replay body still saidresult: redwith nochecks.atsha, so the guard refused to read it; the checkpoint above now names this tip andgreen, and re-running the guard is what clears it.Not run: no real browser on this box, so nobody has looked at a Chinese Add friend panel in a window — the render is read from the component tree in the test instead. This cut covers only the Add friend panel and the invite controls it shares with a Bot's Sharing page:
AcceptNotices/ShareRequests(cut 18),ManageAccess/ShareWithFriend(cut 20), the waiting room (cut 21), the timeline's 46 pins and the tree's remaining 6 keep their baseline pins, and the rest of Social stays English in a zh window as before. The ordering with#3112is not exercised: both add zh keys only, and whichever merges second keeps both blocks and rerunsbuild-client→generate→check→canonical.