Skip to content

fix(i18n): make resume-park toast copy locale-aware - #4556

Open
bytelazy wants to merge 3 commits into
apache:mainfrom
bytelazy:fix/i18n-resume-park-locale
Open

fix(i18n): make resume-park toast copy locale-aware#4556
bytelazy wants to merge 3 commits into
apache:mainfrom
bytelazy:fix/i18n-resume-park-locale

Conversation

@bytelazy

@bytelazy bytelazy commented Sep 2, 2026

Copy link
Copy Markdown

Summary

resumeParkToastCopy() took 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.

This change restructures the copy module into a per-locale UiLocale table:

  • zh keeps the existing strings verbatim.
  • en adds an English translation of all 29 reason strings, the two
    resume_candidate_missing strings, and the title/fallback.
  • resumeParkToastCopy(reasons, locale) now selects the table by locale.
  • The apps/desktop call site in use-shell-resume.ts passes the uiLocale
    it already holds.

Scope: this addresses the user-visible resumeParkToastCopy half of the
issue. The connection-error-copy.ts contract cleanup the issue also
describes is a stale-boundary refactor with no current user-visible effect and
is intentionally left for a follow-up, so this PR uses Refs rather than
Fixes.

Refs #4489

Verification

  • Ran the new unit test with node --experimental-strip-types (Node
    v24.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 zh and en
    (so the two locale tables cannot drift apart), plus the
    resume_candidate_missing and unrecognized-reason fallback branches in both
    locales.
  • Confirmed zh output is unchanged (same strings as before) and en output
    is fully localized.

Not run: the full desktop lint/typecheck/test suites and a live Desktop launch
(a full npm ci would not complete from this network). The change is confined
to packages/ui/src/runtime-resume-copy.ts, its new test, and the single call
site in use-shell-resume.ts, which already has uiLocale in scope.

AI use

  • Generative tooling made a substantive contribution

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

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above

…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)
@github-actions github-actions Bot added the effort/M Under 500 readable lines label Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant