fix(i18n): make resume-park toast copy locale-aware - #4556
Open
bytelazy wants to merge 3 commits into
Open
Conversation
…dows The desktop stories entry was built with resolve(REPO_ROOT, ...), which produces a backslash absolute path on Windows. Glob matchers treat backslashes as escape characters, so the pattern matched nothing and the desktop stories were silently dropped from the index (53 entries instead of 251). The neighboring packages/ui entry is a forward-slash, config-relative glob, which is why only the UI stories kept working. Use the same config-relative form for the desktop entry so the glob matches on all platforms. Fixes apache#4516 Generated-by: Claude (Claude Code)
…nbox The turn-request inbox polls every owner Runtime Host on a 2s interval. A Host with no collaboration authority (e.g. the default Local Host) rejects each query with operation_unavailable, and when every Host rejected, collectAvailablePendingTurnRequests threw an AggregateError. The renderer caught it and retried, so Electron logged the same rejected IPC handler call every two seconds after startup — an unbounded stream of identical errors that buries real diagnostics. An unavailable collaboration capability is a valid Host composition, not a failure, so resolve the inbox as empty when no Host answered instead of throwing. The poller then keeps a quiet, empty inbox and repopulates it as soon as a capable Host appears. Mixed-capability setups are unchanged: a Host that still answers keeps contributing its requests. Fixes apache#4522 Generated-by: Claude (Claude Code)
resumeParkToastCopy() exposed no UiLocale parameter and returned hardcoded Chinese, so an English-locale Desktop user who resumed a parked session saw a Chinese toast title, a Chinese description, and the same Chinese text again in the inline detail. The locale was already in scope at the call site — the success and error branches of the same try block are localized; only the park branch skipped it. Restructure the copy module into a per-locale UiLocale table (zh keeps the existing strings; en adds an English translation of every reason, the two resume_candidate_missing strings, and the title/fallback), and pass uiLocale at the apps/desktop call site. Add a unit test that sweeps every documented reason key in both locales so the tables cannot drift apart. Scope: this addresses the user-visible resumeParkToastCopy half of the issue. The connection-error-copy.ts contract cleanup it also describes is left for a follow-up. Refs apache#4489 Generated-by: Claude (Claude Code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resumeParkToastCopy()took noUiLocaleparameter and returned hardcodedChinese, so an English-locale Desktop user who resumed a parked session saw a
Chinese toast title, a Chinese description, and the same Chinese text again in
the inline detail. The locale was already in scope at the call site — the
success and error branches of the same
tryblock are localized; only the parkbranch skipped it.
This change restructures the copy module into a per-locale
UiLocaletable:zhkeeps the existing strings verbatim.enadds an English translation of all 29 reason strings, the tworesume_candidate_missingstrings, and the title/fallback.resumeParkToastCopy(reasons, locale)now selects the table by locale.apps/desktopcall site inuse-shell-resume.tspasses theuiLocaleit already holds.
Scope: this addresses the user-visible
resumeParkToastCopyhalf of theissue. The
connection-error-copy.tscontract cleanup the issue alsodescribes is a stale-boundary refactor with no current user-visible effect and
is intentionally left for a follow-up, so this PR uses
Refsrather thanFixes.Refs #4489
Verification
node --experimental-strip-types(Nodev24.20.0): all 5 cases pass, including a sweep asserting every one of the 29
documented reason keys resolves to non-fallback copy in both
zhanden(so the two locale tables cannot drift apart), plus the
resume_candidate_missingand unrecognized-reason fallback branches in bothlocales.
zhoutput is unchanged (same strings as before) andenoutputis fully localized.
Not run: the full desktop lint/typecheck/test suites and a live Desktop launch
(a full
npm ciwould not complete from this network). The change is confinedto
packages/ui/src/runtime-resume-copy.ts, its new test, and the single callsite in
use-shell-resume.ts, which already hasuiLocalein scope.AI use
Tool(s) and scope: Claude Code — restructured the copy module, wrote the
English translation, added the test, and updated the call site. The commit
carries a
Generated-by: Claude (Claude Code)trailer.Checklist
Does this PR entail a change in behavior?