Uh oh!
There was an error while loading. Please reload this page.
chore(desktop): move inline bilingual copy into catalogs - #4526
Conversation
82b4195 to
b02d78bCompareec167f5 to
e524215Comparee524215 to
2baac07Comparef74b16a to
b01cb0cCompare
Astro-Han
left a comment
There was a problem hiding this comment.
Reviewed at b01cb0c against 1e543a73. The move itself is right: locales/ is where the other 25 catalogs live, the 14 MCP entries × 3 locales, the notification, agent-graph, task-readiness and peer-mesh catalogs are verbatim against the removed code, the ledger only gains three leaf modules and one edge, and the two large deletions remove copy functions and their ReturnType references, nothing else. But the body describes a different PR than the head, and two of the undeclared changes are user-visible.
The body does not match this head. It says 28 files; the diff is 19. It says 19 generalizedErrorMessageChinese / generalizedErrorMessage sites move to generalizedErrorMessageForLocale across desktop and packages/ui; the diff contains no occurrence of generalizedError and touches nothing in packages/ui. The rebase note says main's new route-state vocabulary is synced verbatim; main still has the old keys (see the zh-TW item below). Please rewrite it from the diff, including the behavior answer.
P2: the direct-path badge in Runtime Host settings changes from "直连" / "Direct" to a hardcoded WebRTC / QUIC / TCP.main renders peerMeshCopy.peerPathDirect for every direct path (runtime-host-profiles-section.tsx:702-704); the new peerPathLabel (:861-873) returns three English literals written into the component, which is the opposite of what this PR is for, and the transport already appears in the tooltip through peerPathDetail. Delete peerPathLabel and keep the badge on peerPathDirect / peerPathTransit. (Path ①.)
P2: decodeConnectionSlug now throws connection slug too_long / connection slug format.validateSlug returning a SlugValidationIssue is fine for the form, but the codec still interpolates the return value into its domain error (connection-catalog-codec.ts:759), and the : went with it, so a catalog with a bad slug reports a machine token instead of "Slug must be 64 characters or fewer". Map the issue back to a sentence in the codec, or leave validateSlug's message and add the code beside it. (Path ①: importing or decoding a catalog.) pi-tui-pickers.ts:1278 only tests truthiness, so the CLI is unaffected.
Smaller:
- zh-TW route states are a real fix, not a relocation:
main's zh-TW branch still keysroute_available / coordination_only / stale / unknown(runtime-host-peer-mesh-dialog.tsx:2087-2093) whilePeerMeshMemberProjection.stateislocal | connecting | reachable | reconnecting | needs_repair(peer-mesh/node.ts:205), so zh-TW users see nothing today;peer-mesh-copy.ts:422-428gives them four new strings. Say so in the body, and add those keys totraditional-chinese-peer-mesh-copy.test.ts, which is the test that exists for exactly this. - The slug error copy changes in all three locales, not only zh (en goes from one sentence to three), so "the one behavior change" is understated.
copyPeerIdandpeerIdCopiednow exist in bothpeer-mesh-copy.tsandsettings-projects-copy.ts; onmainthe settings section read them from the dialog's catalog. One of the two should import the other.agent-graph-panel.tsxkeepsexport { getAgentGraphPanelCopy }as a pass-through of the moved function; point the callers at the catalog and drop it.
Ordering: shares settings-provider-copy.ts with #4524, #4641 and #4551, and settings-projects-copy.ts plus the ledger with #4641. git merge-tree is clean against #4524 at 2f75546; whichever of #4641 / #4551 lands second rebases.
Manual acceptance (three locales, none run here): Runtime Host settings direct/transit badge and tooltip; Peer Mesh member list in zh-TW across the five states; the three slug errors in the add-provider form; the error text on importing a catalog with a bad slug.
Evidence boundary: static read of the diff against main, plus a literal-multiset comparison of removed vs added strings per catalog; no build, no suites, no Desktop.
AI-assisted review: drafted with Maka; I verified the badge label on main, the codec message, the zh-TW route-state keys and the body mismatch myself.
Typed locale catalogs are the mandated home for user-visible copy; inline locale ternaries scattered through components bypass that and make copy audits miss strings. This is the mechanical consolidation wave: zh and en strings are moved verbatim into UiCatalog-shaped tables with no behavior or string changes. The one exception is the peer route state catalog, which loses a sixth key that the closed five-value union could never render. Generated-by: Claude Code Claude-Session: https://claude.ai/code/session_01AqdSkg56F2x55wEGRWvzcB
b01cb0c to
db06d34CompareThanks, all addressed at 8efea18 (rebased on
Manual acceptance in the three locales is still not run; the React/linkedom render tests are what stands in for it. |
Generated-by: OpenCode
db06d34 to
8efea18Compare
Astro-Han
left a comment
There was a problem hiding this comment.
Re-reviewed at 8efea18. Everything from last round is closed in code, and the body now describes this diff:
- The direct-path badge is back on
peerPathDirect/peerPathTransitwith the transport only in the tooltip, andpeerPathLabelis gone. decodeConnectionSlugmaps the issue code back to the three original sentences with the:;runtime-policy-codec.test.tspins all three.- zh-TW route states are declared as a behavior change and asserted key by key in the zh-TW copy test; the slug errors are declared for all three locales.
copyPeerId/peerIdCopiedhave one home again, the settings section imports the peer-mesh catalog for them, and the agent-graph pass-through export is gone.
The new connection-settings-locale-render.test.ts renders the badge, tooltip, slug errors and the five zh-TW member states through the real components in all three locales, using the same esbuild-into-dist bundling that password-input.test.ts already uses, so it is not a new harness. The ledger delta is three leaf catalog modules plus one edge, no owner growth.
Nothing left to ask for. Ordering: shares settings-provider-copy.ts with #4641 and #4551 and the ledger with #4641; merge-tree is clean against all three at their current heads, whichever lands later rebases.
Manual acceptance was not run by either of us; the render tests stand in for it, and the two user-visible changes are small (five zh-TW labels, three slug sentences).
Evidence boundary: static read of the delta since b01cb0c against 03b5a2cc5a; no build, no suites.
AI-assisted review: drafted with Maka; I verified the badge, the codec message and the ledger delta myself.
The permission-center guidance list was removed in 02604e2 (no producer fills guidance; apache#4526's layered rows carry the actionable lines), but the snapshot-side plumbing survived: the CapabilitySnapshot.guidance field, staticCapability's guidance input, botCapability's empty array, and the fixtures' guidance: [] entries. Every future producer had to keep feeding a write-only field. Delete the field, the producer parameter, the botCapability entry, and the fixture entries; fix the permission-center comment that still named the removed guidance list. Generated-by: Claude Code
Summary
Traditional Chinese Peer Mesh members can have blank connection-state labels, and invalid provider identifiers show raw English errors in Simplified Chinese or a generic error in the other locales.
Move Peer Mesh, Agent Graph, and task-readiness copy into typed
UiCatalogmodules; consolidate notification and MCP copy into typed locale tables. Settings reuse Peer Mesh identity copy directly, and Agent Graph callers import its catalog rather than a component re-export. Nopackages/uior generalized-error-helper migration is included.Two intentional behavior changes remain: align zh-TW route labels with the five protocol states (the old keys missed all four non-local states), and present required/format/length slug errors in all three locales.
validateSlugreturns stable issue codes; the catalog codec maps them back to its existing readable diagnostics. Validation rules are unchanged. Runtime Host badges remain Direct/Member transit, with transport names only in the tooltip.Verification
npm run typecheckpassed all four tsconfigs, including Storybook.npm run lint,npm run format:check,npm run check:tui-copy, andnpm run check:locale-hygienepassed.03b5a2cc5.git diff --checkpassed.Before the review fixes (
84353649e, new regression tests):After (
db06d3437, test output excerpts):UI assertions use React with linkedom; full Electron E2E and manual Desktop/Storybook acceptance were not run.
AI use
Tool(s) and scope: Claude Code for the original catalog migration; OpenCode for review fixes, regression tests, validation, and this description. The respective commits carry
Generated-by: Claude CodeandGenerated-by: OpenCode; retain both when squashing. Human review is still required.Checklist
Does this PR entail a change in behavior?