Repository navigation
Description
Description
Two localization gaps are still open in 2.1.2 (desktop). Both are verified against the shipped build (resources/opencode-cli.exe contains the exact strings quoted below). This is a re-file of #51016, which was closed during the V1 triage and cannot be reopened.
The front-end half of the original report is already fixed: the compaction panel now uses the ui.messagePart.compaction.* i18n keys, and the old V1 headings are gone from the UI. What remains is narrower and lives in the core.
1. /init and /review descriptions are English in every locale
packages/core/src/plugin/command.ts:
30: name: "init",
31: description: "guided AGENTS.md setup",
43: name: "review",
44: description: "review changes [commit|branch|pr], defaults to uncommitted",There is no t() lookup, and no key to supply one: command.init and command.review do not exist in packages/app/src/runtime/i18n/en.ts or zh.ts. The composer passes the string through untouched (packages/app/src/composer/model.ts:226-232, description: item.description), and the plugin API only accepts a plain string (packages/plugin/src/effect/command.ts:16), so no locale can override it. Every other slash entry resolves through language.t(...) (packages/app/src/session/commands/use-session-commands.tsx:327-374); these two are the only exceptions.
2. The compaction summary headings are English by construction
packages/core/src/session/compaction.ts:107-138 holds the model-facing SUMMARY_TEMPLATE with ## Objective, ## Work State, ## Next Move, ## Relevant Files. buildPrompt (line 148) takes no locale, and the reply is rendered as-is by PacedMarkdown (packages/session-ui/src/message/message-content.tsx:638).
This one cannot be fixed with UI strings alone, because the same template is used to validate the reply:
287: const headings = SUMMARY_TEMPLATE.split("\n").filter((line) => line.startsWith("##"))
288: const filled = (text: string) => text.split("\n").some((line) => headings.includes(line.trim()))A localized heading fails filled() and costs a retry, so the template itself has to become locale-aware.
Suggested fix: (1) add command.init / command.review keys and map the plugin command name to a key in the composer; (2) pass the UI locale into buildPrompt and derive the heading list from the localized template.
Steps to reproduce
- OpenCode Desktop 2.1.2, set the UI language to Chinese.
- Type
/in the composer:/initshows "guided AGENTS.md setup" and/reviewshows "review changes [commit|branch|pr], defaults to uncommitted" — both in English, while/compact,/undoand/newnext to them are Chinese. - Run
/compact: the summary body contains## Objective,## Work State,## Next Move,## Relevant Files.
Expected: both follow the selected UI language. Actual: only these two entries and the summary template stay English.
OpenCode version
2.1.2 (desktop, bundled CLI 2.1.2; tag v2.1.2, commit a517687fde98a7329ada3ae644a01a9fc6c4e99e). Still present on dev at f7577a1.
Operating System
Windows 11 (10.0.26300)
Terminal
Not applicable (desktop app)
Plugins
None.
Screenshot
Not attached — the difference is textual only.
Activity
opencode-agent commentedon Oct 21, 2026
Thanks for the detailed report. I can confirm the
/initand/reviewpart on 2.1.2, and it still happens on the latestdev(870ab9d).I couldn't run the desktop app or a browser here, so I checked the server and the app code instead. The script below starts
opencode serveand asks it for the command list with a ChineseAccept-Language. It returns only these two built-in commands, with their English descriptions and no locale or translation key:[{"name":"init","description":"guided AGENTS.md setup"},{"name":"review","description":"review changes [commit|branch|pr], defaults to uncommitted"}]The composer (
packages/app/src/composer/model.ts) shows that description unchanged, and the app dictionaries have nocommand.initorcommand.reviewkeys. The neighbouring entries (e.g./compact→ 压缩会话) are translated. So these two stay English in every locale, as you describe.I only checked the compaction headings in the code:
SUMMARY_TEMPLATEis English and is also used to check the reply. That part is about the model's output language, which overlaps with #49889, so maintainers may handle it there.Reproduction script (repro.sh)
Run it:
bash repro.shimgusguo commentedon Oct 21, 2026
I'd like to work on the
/initand/reviewdescriptions. Could you confirm which command-identification approach you prefer?Scope
Route these two descriptions through app i18n in the desktop/web composer, preserving the English wording. Compaction prompts/headings and TUI localization would be separate work.
Following the app's localization guidance, this first change would add English keys and fallback. Non-English translations would follow language review; those locales would still show English until then.
Identifying built-in commands
The command list exposes only
nameanddescription; later definitions can replace same-name commands. Matching by name alone could overwrite a user/plugin description.A — App-only matching (preferred): Translate only when both name and description match the built-in defaults, comparing against the English dictionary. Preserve other descriptions. This avoids a wire-format change, but depends on the default wording and cannot distinguish a custom command with identical name and description.
B — Explicit origin metadata: Carry a built-in marker from registration through the command list. This reliably distinguishes overrides, but expands the change to command interfaces, schema, and generated clients.
Verification
Extend existing slash-command coverage for default descriptions, same-name/custom overrides, and English fallback. Verify locale switching when reviewed translations are available. Preserve command order and execution behavior.
Would you accept A, or prefer B? I'd take only the description portion of #57828 and reference the issue without closing the compaction portion.
AI assistance: I used Codex to inspect the relevant source and draft this proposal.