feat: add i18n support with zh-CN locale - #53
Conversation
There was a problem hiding this comment.
Thanks for the thorough i18n work. The full local gate passes at efebf958 (lint, typecheck, 278 tests, build, and pack dry-run), but I found three medium localization gaps that need to be addressed before merge:
src/server.ts:1303andsrc/server.ts:1992callcontinuationPrompt(current)without the configuredlocale. Both V1 and V2 watchdog rescues therefore fall back to English underlocale: "zh-CN". Please passlocalein both paths and add watchdog-level regression tests (not only prompt-builder tests), then rebuilddist/server.js.src/tui.ts:406,src/tui.ts:438, andsrc/tui.ts:609translate theStatuslabel but render the raw protocol value (paused,budgetLimited, etc.); plugin-ownedstopReasonvalues are also emitted in English. Please add locale-aware presentation mappings while preserving protocol values internally. The current zh-CN test expecting状态: pausedshould assert the translated value instead. User/authored free text should remain unchanged.src/prompts.ts:139-140embeds raw lifecycle status and plugin-owned English stop reasons in the zh-CN safety-limit wrap-up prompt. Please format those known values for presentation before interpolation.
|
Thanks for the detailed review. All three localization gaps have now been addressed. Both V1 and V2 watchdog rescue paths now correctly propagate the configured locale, with zh-CN regression coverage added at the watchdog level. Validation results: bun run lint ✅ The two remaining failures are the previously documented timing-sensitive watchdog/restart tests. They are reproducible on the unmodified upstream main branch under the same environment. All newly added and modified i18n regression tests pass. |
danyel117
left a comment
There was a problem hiding this comment.
Re-reviewed at 21158c0. The localization gaps are resolved, the Chinese prompts preserve the English safety semantics, and V1/V2 command arguments are structurally escaped to prevent delimiter breakout while keeping legitimate objectives actionable. Local gate: lint, typecheck, 291 tests, build, and pack dry-run all pass. No remaining high/medium review findings.
Summary
Adds first-class i18n support to goal mode, starting with Simplified Chinese (
zh-CN), while preserving English as the default behavior.Related issue
Closes #52
Changes
localeoption with"en"as the default"zh-CN"for Simplified Chinese and"auto"for locale detection fromLC_ALL,LANG, then the OS/runtime localezh-CNmessage catalogs without introducing a runtime dependency/goal,/pause_goal, and/resume_goalprompt templates and command descriptionssrc/i18n.tswith the package because the TUI source imports itlocaleoption and OpenCode 1 TUI configuration in the READMEVerification
Local verification was performed with Bun 1.4.2:
bun run lintpassesbun run typecheckpassesbun run buildpassesdist/server.jswas regenerated and committedThe remaining failures are in existing timing-sensitive watchdog/restart tests. Both are reproducible on the unmodified upstream
mainunder the same environment:V2 watchdog no-response counts a failure on idle even with auto_continue false: 1/10 isolated runs passedrestart resolves a persisted started pending attempt at the next idle: 37/50 isolated runs passedThe upstream GitHub Actions workflow is still awaiting maintainer approval because this PR originates from a fork.
Checklist
bun run testpassesLocal full-suite result: 277/278 tests passed.
The remaining failures are in existing timing-sensitive watchdog/restart tests and are reproducible on the unmodified upstream
mainunder the same Bun 1.4.2 environment:V2 watchdog no-response counts a failure on idle even with auto_continue false: 1/10 isolated runs passed on upstreammainrestart resolves a persisted started pending attempt at the next idle: 37/50 isolated runs passed on upstreammainbun run lintpassesbun run typecheckpassesbun run buildpasses anddist/server.jsis committedREADME/docs updated if behavior or options changed