Repository navigation
Read the Social share cards in the window's language (#3114) - #3210
Conversation
The share-request card and the invite-accepted card drew their sentence, the asked hint, both buttons, the two `your Bot` fallbacks and the Sharing title as bare English, so a Chinese window read English on those two cards while the rest of the Social panel followed the window. `plugins/social/client.js` already has `tr()`; these eleven lines now go through it and the seven entries land in `core/src/client/i18n.js`, so the three i18n baselines drop the eight entries that pinned the draws. A window without a translator keeps today's English word for word. Fixes #3209 Part of #3114 Docs-not-needed: the two cards keep their layout, state and server calls; this cut adds seven zh dictionary entries and routes eleven existing literals through the panel's own tr(). docs/subsystems/social.md and core-client.md describe the panel and the bundle, not its copy.
|
Verdict: PASS at 1cc8ee0 Ran at this tip: Red first: with the implementation alone reverted to Tier: recomputed with the repository's own gate at this tip — the Scope (13 files, +233/−29; handwritten 7 files +201/−19): Baselines only shrink: parsed arrays show 3 removed from Reuse, no new duplicates: the dictionary gains exactly 7 keys (5 single-line + 2 wrapped across two lines), the ZH object has no duplicate key, and Generated files agree with source: No-translator window: case 3 pins the bare-window English draw ( Suites at the tip: new test 3/3; CI at the head: 21 check-runs, all Grounds in the body are the two §1.1 ones — the repo's own i18n ratchet (the
Checkpoint block: valid JSON, Not run: |
Written-by: Dev
Fixes #3209
Part of #3114
Owner: Dev
Reviewer: Reviewer
Tier: T2
Checkpoint
{
"pr": 3210,
"claim": "Dev",
"issue": 3209,
"summary": "The Social panel's share-request card and invite-accepted card now draw through the panel's existing tr(), so a Chinese window reads the dictionary's sentence, hint line, buttons and Sharing title instead of bare English. Seven zh entries land in core/src/client/i18n.js and reuse the existing Dismiss and your Bot. The three i18n baselines drop the eight entries that pinned those draws, and a window whose host has no translator keeps today's English character for character. Adds plugins/social/test/share-cards-i18n.test.js: 3 cases, red 3/0/3 then green 3/3.",
"files": [
"plugins/social/client.js",
"plugins/social/test/share-cards-i18n.test.js",
"core/src/client/i18n.js",
"core/test/i18n-plugins.baseline.json",
"core/test/i18n-template-draws.baseline.json",
"core/test/i18n-missing-entries.baseline.json",
"changelog.d/3114-social-share-cards-zh.changed.md"
],
"checks": { "ran": "TZ=UTC TMPDIR=/data/flybot-tmp npm run verify", "result": "green", "at": "1cc8ee0794dbb096634d0f772c8a571021bec59e" },
"next": "none — ready for review"
}
What changed
Eleven lines in
plugins/social/client.jsmoved to thetr()the rest of that file already uses: theshare-request sentence, the accepted-invite sentence (and the two
your Botfallbacks), theYou asked them to share a Bot.hint, theAsk them to share a Botbutton, bothDismissbuttons, theOpen {bot}'s Sharingtitle andShare {bot}….core/src/client/i18n.jsgains the seven matchingzh entries (
A friendis one of them;Dismissandyour Botwere already there and are reused, neverduplicated). The three i18n baselines lose exactly the eight entries that pinned these draws:
Dismiss#1and
Dismiss#2fromi18n-plugins.baseline.json, three fromi18n-template-draws.baseline.json, threefrom
i18n-missing-entries.baseline.json. Nothing else in those files changed, and no new baseline entrywas added — the ratchet only shrinks.
Why
Two grounds, both on this repository, neither borrowed from the parent issue's wish list:
core/test/i18n-missing-entries.test.jssays in itsheader that "a value with no zh key cannot be translated — it is the gap, and the baseline pins today's
gaps", and that the baseline "may only shrink … each leaves the baseline when its zh entry lands — never
by editing the baseline".
core/test/i18n-plugins.test.js(bare draws) andcore/test/i18n-template-draws.test.js(${}template draws) are the other two views of the same debt,and on
mainall eight entries above are pinned by them.chrome is Chinese while these two cards still read
Helper (Eve) tried to start a chat with Writer. Writer is not shared with them./Dismiss/Share Writer…andChief Grant (SelfB1025) accepted your invite. …/Dismiss/Ask them to share a Bot.Scope
Only the two cards. The rest of Social's i18n debt stays in the baselines (
Close,Copy,Copy link,New link,Your Bots, …) — this PR does not claim to finish it. Nothing undercore/src/host/**,core/src/shared/**,plugins/social/src/**,plugins/social/index.js,.github/**,policy/**orauthz.jsis touched. Generated files arecore/client.jsandpatches/ds-bot/**, rebuilt in the fixedorder (build-client → add → generate → check → canonical → mojibake).
Overlap with #3112
#3112 is still open (
mergeable_state: dirty) and adds its own'A friend': '一位好友'next to'Friend requests'. Both hunks are incore/src/client/i18n.jsbut do not overlap, so git will keep bothand leave a duplicate key: whichever lands second deletes its own
'A friend'and keeps the other'sposition;
grantRequestSentence'str('A friend')then uses the remaining key. If #3112 lands first, thiscard drops that one line and the handwritten count becomes
+200/−19(see A12 in the spec).Docs-not-needed: the two cards keep their layout, state and server calls; this cut adds seven zh dictionary entries and routes eleven existing literals through the panel's own tr(). docs/subsystems/social.md and core-client.md describe the panel and the bundle, not its copy.
Verification at the tip (
1cc8ee0794dbb096634d0f772c8a571021bec59e)Ran:
cd plugins/social && TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot node --import ./test/resolve.mjs --test test/share-cards-i18n.test.js→# tests 3 / # pass 3 / # fail 0(red first, unmodified implementation, same command:3 / 0 / 3, messages below).Ran:
cd core && TZ=UTC TMPDIR=/data/flybot-tmp 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 / 39 / 0.Ran:
cd plugins/social && … --test test/social.test.js→500 / 500 / 0;… --test test/social-readonly.test.js test/face-chip-i18n.test.js→20 / 20 / 0.Ran:
cd core && node scripts/build-client.mjs;node scripts/ds-bot-patches.mjs generate→check→ threeoklines;canonical→ok patches/ds-bot/ is what generate writes;node .github/scripts/check-mojibake.mjs --check→ok — 0 occurrences of U+FFFD.Ran:
node .github/scripts/changelog.mjs check→13 fragment(s) in changelog.d/ are well formed.Ran:
TZ=UTC TMPDIR=/data/flybot-tmp npm run verify→ exit 0 (arch-docs: OK (13 changed file(s))).Ran:
git diff --numstat base -- plugins/social core/src core/test changelog.d→+201 / −19, 7 handwritten files, 220 lines;git diff --name-only base→ 13 paths (7 handwritten + 6 generated).baseis the tarball commit5068074de86e, whose tree50616cdc31eee0febb3b3b18c6df2c313378d043is c0061ba's tree.Red-first messages, verbatim from the unmodified implementation:
the share request still reads: Helper (Eve) tried to start a chat with Writer. Writer is not shared with them.the accept notice still reads: Chief Grant (SelfB1025) accepted your invite. They can message Chief. You cannot message them until they share a Bot with you.the baselines still pin an English draw: plugins/social/client.js:Open {}'s Sharing, plugins/social/client.js:Share {}…, plugins/social/client.js:{} tried to start a chat with {}. {} is not shared with them., plugins/social/client.js:Ask them to share a Bot, plugins/social/client.js:You asked them to share a Bot., plugins/social/client.js:{} accepted your invite. They can message {}. You cannot message them until they share a Bot with you.Not run: a real browser check of the mixed-language panel — the zh dictionary and the rendered tree are
covered here, but nobody opened Social in a Chinese window.
Not run: the
#3112interaction — that PR is open and dirty, so the duplicate'A friend'key cannot beobserved on
mainyet; the rule for whichever lands second is written under Overlap with #3112.Not run: Social's other i18n debt (
Close,Copy,Copy link,New link,Your Bots, …) — it stayspinned in
i18n-plugins.baseline.json; this PR only shrinks the eight entries it settles.