You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: i18n / Locale support (Portuguese and other languages) #35831
I have searched existing issues and confirmed this is not a duplicate
Summary
I have since discovered that OpenCode already has an i18n system in place — there are English translation files at packages/ui/src/i18n/en.ts and packages/app/src/i18n/en.ts, and Portuguese is already listed as a language option ("language.br": "Português (Brasil)").
Updated Request: Portuguese (Brazil) translation
Since the infrastructure is already ready, what's needed is the actual Portuguese translation files:
packages/ui/src/i18n/br.ts — translate all UI strings to Portuguese (Brazil)
packages/app/src/i18n/br.ts — translate all app strings to Portuguese (Brazil)
changed the title [-]Feature Request: i18n / Locale support (Portuguese and other languages)[/-][+][FEATURE]: i18n / Locale support (Portuguese and other languages)[/+]on Jul 8, 2026
Thanks for updating the issue! It now meets our contributing guidelines. We appreciate you adding the [FEATURE]: prefix and the duplicate-search confirmation.
@mike652638 obrigado pela sugestão e pelos links! Analisei seu opencode-zh-plugin — abordagem inteligente usando experimental.chat.system.transform e api.slots.register().
Acabei seguindo um caminho um pouco diferente: como a TUI do OpenCode tem todas as strings hardcoded em inglês (sem camada i18n), fiz um fork com a tradução completa embutida no código-fonte:
A diferença da sua abordagem: a sua traduz via plugin (em runtime, sem tocar no repo), a minha traduz o TUI diretamente no código — resultado idêntico para o usuário final, mas sem depender de hooks experimentais. A estrutura locale/strings.ts do seu plugin pode ser útil se alguém quiser um dia portar isso para o mecanismo de plugin oficial.
Valeu pelo trabalho com o plugin! Qualquer contribuição para o fork é bem-vinda.
Como a TUI do OpenCode não tem camada i18n (todas as strings são hardcoded em inglês), criei o fork RicSchonfelder/opencode-i18n-pt com a tradução embutida:
Branch feat/pt-br-tui — tradução da interface de terminal:
✅ Paleta de comandos (Ctrl+P) — todos os comandos e categorias em pt-BR
Base atualizada: a branch dev do fork está sincronizada com o upstream.
Documentação completa de como a tradução foi feita: TRADUCAO-PT-BR.md
Se algum mantenedor quiser integrar isso ao upstream, é só dar um git cherry-pick da branch — as mudanças são isoladas em packages/tui/src + descrições de agentes.
Atualização: build funcional e descoberta importante sobre cross-compile ✅
O binário Windows traduzido agora funciona de ponta a ponta (incluindo envio de prompts). Uma descoberta relevante para o upstream:
⚠️bun run build no Windows gera binário com bug
Ao buildar o packages/opencodenativamente no Windows, o binário resultante falha ao enviar qualquer prompt com:
TypeError: undefined is not an object (evaluating 'a.name')
no LayerNode.walk (packages/core/src/effect/layer-node.ts) — ocorre ao montar o grafo locationServices no SystemPrompt.environment.
Testei: bun 1.4.2 e 1.3.14, com/sem --minify, com/sem web UI embed, config isolada — todo build no Windows falha.
✅ Cross-compile no Linux resolve
Buildar o mesmo código no Linux (WSL/Ubuntu 24.04, como o GitHub Actions faz) gera um binário Windows funcional:
wsl
cd packages/opencode
bun run build # builda todos os targets, inclui opencode-windows-x64
Teste validado: opencode.exe run "diga OK" responde corretamente (exit 0).
O release oficial sempre foi cross-compilado no Linux — este teste confirma que essa não é só uma escolha de CI, é necessário para um binário Windows correto.
Activity
github-actions commentedon Jul 8, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:(current title: "Feature Request: i18n / Locale support (Portuguese and other languages)")Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
[-]Feature Request: i18n / Locale support (Portuguese and other languages)[/-][+][FEATURE]: i18n / Locale support (Portuguese and other languages)[/+]github-actions commentedon Jul 8, 2026
Thanks for updating the issue! It now meets our contributing guidelines. We appreciate you adding the
[FEATURE]:prefix and the duplicate-search confirmation.RicSchonfelder commentedon Jul 8, 2026
PR with the complete Portuguese translation has been submitted: #35836
mike652638 commentedon Jul 18, 2026
Hey @RicSchonfelder — 关于 i18n 支持,我们已经基于官方 Plugin API 实现了中文本地化方案,可供参考和扩展:
opencode-zh-plugin — 通过
experimental.chat.system.transformhook 注入多语言 system prompt,AI 回复切换为目标语言;同时通过api.slots.register()汉化 TUI 界面。理论上只需修改 locale 配置即可扩展到其他语言。opencode plugin add opencode-zh-pluginopencode-zh-desktop — CDP 注入 Desktop Electron UI 的菜单栏翻译。
如果你计划扩展葡萄牙语或其他语言的支持,插件的
locale/strings.ts结构和 Plugin API 模式可以直接复用。欢迎参考或 contribute!github-actions commentedon Sep 18, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
RicSchonfelder commentedon Sep 19, 2026
@mike652638 obrigado pela sugestão e pelos links! Analisei seu
opencode-zh-plugin— abordagem inteligente usandoexperimental.chat.system.transformeapi.slots.register().Acabei seguindo um caminho um pouco diferente: como a TUI do OpenCode tem todas as strings hardcoded em inglês (sem camada i18n), fiz um fork com a tradução completa embutida no código-fonte:
📦 Fork:
RicSchonfelder/opencode-i18n-pt(branchfeat/pt-br-tui)A diferença da sua abordagem: a sua traduz via plugin (em runtime, sem tocar no repo), a minha traduz o TUI diretamente no código — resultado idêntico para o usuário final, mas sem depender de hooks experimentais. A estrutura
locale/strings.tsdo seu plugin pode ser útil se alguém quiser um dia portar isso para o mecanismo de plugin oficial.Valeu pelo trabalho com o plugin! Qualquer contribuição para o fork é bem-vinda.
RicSchonfelder commentedon Sep 19, 2026
Status: tradução completa disponível no fork 🇧🇷
Como a TUI do OpenCode não tem camada i18n (todas as strings são hardcoded em inglês), criei o fork
RicSchonfelder/opencode-i18n-ptcom a tradução embutida:Branch
feat/pt-br-tui— tradução da interface de terminal:Base atualizada: a branch
devdo fork está sincronizada com o upstream.Documentação completa de como a tradução foi feita:
TRADUCAO-PT-BR.mdSe algum mantenedor quiser integrar isso ao upstream, é só dar um
git cherry-pickda branch — as mudanças são isoladas empackages/tui/src+ descrições de agentes.RicSchonfelder commentedon Sep 19, 2026
Atualização: build funcional e descoberta importante sobre cross-compile ✅
O binário Windows traduzido agora funciona de ponta a ponta (incluindo envio de prompts). Uma descoberta relevante para o upstream:
bun run buildno Windows gera binário com bugAo buildar o
packages/opencodenativamente no Windows, o binário resultante falha ao enviar qualquer prompt com:no
LayerNode.walk(packages/core/src/effect/layer-node.ts) — ocorre ao montar o grafolocationServicesnoSystemPrompt.environment.Testei: bun 1.4.2 e 1.3.14, com/sem
--minify, com/sem web UI embed, config isolada — todo build no Windows falha.✅ Cross-compile no Linux resolve
Buildar o mesmo código no Linux (WSL/Ubuntu 24.04, como o GitHub Actions faz) gera um binário Windows funcional:
Teste validado:
opencode.exe run "diga OK"responde corretamente (exit 0).O release oficial sempre foi cross-compilado no Linux — este teste confirma que essa não é só uma escolha de CI, é necessário para um binário Windows correto.
Fork:
RicSchonfelder/opencode-i18n-pt(branchfeat/pt-br-stable, basev1.18.25).RicSchonfelder commentedon Sep 20, 2026
@mike652638 谢谢你的建议和分享你的中文插件!
我们已经完成了葡萄牙语(巴西)的完整翻译,并解决了你提到的问题:
✅ 已完成的工作
1. 完整的 PT-BR 翻译
2. 关键问题修复:Windows build bug
发现:在 Windows 上原生 build (
bun run build) 会生成有 bug 的二进制文件,发送 prompt 时崩溃:位置:
packages/core/src/effect/layer-node.ts的LayerNode.walk方法根因:Windows 原生 build 的 minification/tree-shaking 导致
LayerNode.walk中的node.dependencies包含undefined,导致replacementMap.get(node.name)失败。解决方案:必须在 Linux/WSL 上 cross-compile(和 GitHub Actions CI 完全一致):
现在的 release
pt-br-v1.18.31正是用这种方式 build 的,已验证可用。3. 版本号修复
Script.version在 feature branch 生成0.0.0-...,导致 Zen 报错 "OpenCode 1.18.0 or newer"。修复:build 时指定
OPENCODE_VERSION=1.18.31,现在二进制正确报告1.18.31。4. 仓库结构
RicSchonfelder/opencode-i18n-ptfeat/pt-br-stable(base v1.18.31 + 翻译)pt-br-v1.18.31包含 baseline + Windows x645. 你的插件启发
你的
opencode-zh-plugin用experimental.chat.system.transformhook 注入 system prompt 的方式很聪明!我们的翻译是直接修改源码字符串,不同路径但目标相同。你的 plugin 结构 (locale/strings.ts) 可以作为未来官方 i18n 支持的参考。相关链接
feat/pt-br-stable)HOWTO-TRADUCAO.md(翻译全流程指南)欢迎 PR 或 issue 讨论!
RicSchonfelder commentedon Sep 20, 2026
@mike652638 谢谢你的建议和分享你的中文插件!
我们已经完成了葡萄牙语(巴西)的完整翻译,并解决了你提到的问题:
✅ 已完成的工作
1. 完整的 PT-BR 翻译
2. 关键问题修复:Windows build bug
发现:在 Windows 上原生 build (
bun run build) 会生成有 bug 的二进制文件,发送 prompt 时崩溃:位置:
packages/core/src/effect/layer-node.ts的LayerNode.walk方法根因:Windows 原生 build 的 minification/tree-shaking 导致
LayerNode.walk中的node.dependencies包含undefined,导致replacementMap.get(node.name)失败。解决方案:必须在 Linux/WSL 上 cross-compile(和 GitHub Actions CI 完全一致):
现在的 release
pt-br-v1.18.31正是用这种方式 build 的,已验证可用。3. 版本号修复
Script.version在 feature branch 生成0.0.0-...,导致 Zen 报错 "OpenCode 1.18.0 or newer"。修复:build 时指定
OPENCODE_VERSION=1.18.31,现在二进制正确报告1.18.31。4. 仓库结构
RicSchonfelder/opencode-i18n-ptfeat/pt-br-stable(base v1.18.31 + 翻译)pt-br-v1.18.31包含 baseline + Windows x645. 你的插件启发
你的
opencode-zh-plugin用experimental.chat.system.transformhook 注入 system prompt 的方式很聪明!我们的翻译是直接修改源码字符串,不同路径但目标相同。你的 plugin 结构 (locale/strings.ts) 可以作为未来官方 i18n 支持的参考。相关链接
feat/pt-br-stable)HOWTO-TRADUCAO.md(翻译全流程指南)欢迎 PR 或 issue 讨论!
RicSchonfelder commentedon Sep 20, 2026
@mike652638 谢谢你的建议和分享你的中文插件!
我们已经完成了葡萄牙语(巴西)的完整翻译,并解决了你提到的问题:
✅ 已完成的工作
1. 完整的 PT-BR 翻译
2. 关键问题修复:Windows build bug
发现:在 Windows 上原生 build (
bun run build) 会生成有 bug 的二进制文件,发送 prompt 时崩溃:位置:
packages/core/src/effect/layer-node.ts的LayerNode.walk方法根因:Windows 原生 build 的 minification/tree-shaking 导致
LayerNode.walk中的node.dependencies包含undefined,导致replacementMap.get(node.name)失败。解决方案:必须在 Linux/WSL 上 cross-compile(和 GitHub Actions CI 完全一致):
现在的 release
pt-br-v1.18.31正是用这种方式 build 的,已验证可用。3. 版本号修复
Script.version在 feature branch 生成0.0.0-...,导致 Zen 报错 "OpenCode 1.18.0 or newer"。修复:build 时指定
OPENCODE_VERSION=1.18.31,现在二进制正确报告1.18.31。4. 仓库结构
RicSchonfelder/opencode-i18n-ptfeat/pt-br-stable(base v1.18.31 + 翻译)pt-br-v1.18.31包含 baseline + Windows x645. 你的插件启发
你的
opencode-zh-plugin用experimental.chat.system.transformhook 注入 system prompt 的方式很聪明!我们的翻译是直接修改源码字符串,不同路径但目标相同。你的 plugin 结构 (locale/strings.ts) 可以作为未来官方 i18n 支持的参考。相关链接
feat/pt-br-stable)HOWTO-TRADUCAO.md(翻译全流程指南)欢迎 PR 或 issue 讨论!