Skip to content

feat(i18n): add Brazilian Portuguese (pt) locale - #10934

Closed
joaoguilhermesimon-collab wants to merge 3 commits into
stablyai:mainfrom
joaoguilhermesimon-collab:feat/i18n-pt-br
Closed

joaoguilhermesimon-collab wants to merge 3 commits into
stablyai:mainfrom
joaoguilhermesimon-collab:feat/i18n-pt-br

Conversation

@joaoguilhermesimon-collab

@joaoguilhermesimon-collab joaoguilhermesimon-collab commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds Brazilian Portuguese (pt) as a built-in UI locale, alongside en, zh, ko, ja, and es. Users can select Português (Brasil) in Settings → Appearance → Language, and a system locale of pt-BR / pt-PT now resolves to it automatically.

The repo already ships a README.pt.md, so there is clear interest from Portuguese speakers — this closes the gap for the app itself.

Catalog scaffolded with config/scripts/bootstrap-locale-catalog.mjs --locale pt, giving exact key parity with the other locales (11,445 keys). 1,644 strings are translated, covering the day-to-day surfaces: app shell and window chrome, main menu and tray, every Settings pane title and description, workspace/worktree/branch/repo flows, the new-workspace composer including SSH host setup, the GitHub/GitLab/Jira/Linear item dialogs, PullRequestPage, TaskPage, Terminal, QuickOpen, and GitHub Projects. Remaining keys fall back to English via fallbackLng.

The four existing non-English catalogs each gain exactly one line: the settings.appearance.language.portuguese label. Its value is Português (Brasil) in all of them, since language names are endonyms and are not translated — matching how 中文(简体), 한국어, 日本語, and Español already appear in every catalog. This keeps verify-localization-catalog parity green.

Deliberately left in English: agent names (Claude, Codex, Cursor…), Git vocabulary Brazilian developers use untranslated day to day (worktree, merge, diff, branch, PR, MR), and internal discriminator strings the UI switches on (default, destructive, sheet, page).

Screenshots

No visual change — no new or changed UI behavior. The only surface difference is one additional entry in the existing Settings → Appearance → Language dropdown.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Being explicit rather than ticking boxes I did not fully run:

  • Lint: oxlint passes with 0 errors on the changed files. The pnpm lint wrapper did not complete on my machine for an unrelated reason (I run pnpm through corepack, so the nested pnpm run … calls in that script have no pnpm on PATH). I ran its localization steps directly instead:
    • node config/scripts/verify-localization-catalog.mjs — passes: Verified locale parity for pt.json (11445 keys).
    • node config/scripts/audit-localization-coverage.mjs --check — reports 6 pre-existing unlocalized strings, all Ghostty keywords in terminal-advanced-platform-search.ts and terminal-pane-appearance-search.ts. Neither file is touched by this PR.
  • Typecheck: tsc --noEmit passes for config/tsconfig.node.json and config/tsconfig.tc.web.json.
  • Tests / build: not run. The native module rebuild fails on my Windows machine (node-gyp needs Visual Studio Build Tools, which I do not have installed), so pnpm build and anything requiring the Electron runtime cannot execute here.
  • On new tests: this change adds no functions or branches — it is locale data plus registration. The regression surface is already covered by verify-localization-catalog (key parity) and by the exhaustive Record types on NON_DEFAULT_LOCALE_LOADERS, LAZY_LOCALE_LOADERS, and UI_LANGUAGE_CHOICE_FALLBACKS, which turn a missing registration into a build error. That is not theoretical: it is exactly how the main-process loader in src/main/i18n/main-i18n.ts was caught during development, after only the renderer loader had been registered.

AI Review Report

Reviewed with Claude (Anthropic). Risks checked and outcomes:

  • Completeness of locale registration. The main risk for this kind of change is registering a locale in some places but not all, producing a picker entry that silently falls back to English. The review traced every consumer of SupportedUiLocale and BuiltInUiLanguage. It initially missed LAZY_LOCALE_LOADERS in the main process; pnpm typecheck caught it and it was added.
  • Placeholder integrity. All interpolations in the translated strings were diffed against their English counterparts: {{value0}} ×137, {{value1}} ×25, {{value2}} ×6, {{path}} ×5, plus {{hostName}}, {{names}}, {{count}}. No malformed or dropped placeholders.
  • Scope of catalog edits. Verified that the four existing non-English catalogs receive exactly one added line each and no other modification.
  • Untranslated-by-design strings. Checked that values the UI switches on (default, destructive, sheet, page) were not translated, which would have broken variant logic.
  • Cross-platform. This PR touches no shortcuts, key labels, filesystem paths, shell invocations, or Electron platform branches. The locale ids are plain ASCII and the dynamic imports use the same relative-path form as the existing catalogs, so resolution is identical on macOS, Linux, and Windows. One Windows-specific note surfaced during development: a default core.autocrlf=true checkout rewrites these files to CRLF. The commit is LF-only, matching the rest of the repo — worth knowing if a Windows contributor sees whole-file diffs.

Security Audit

Low risk; this is locale data plus type-level registration.

  • Input handling: none. No user input is parsed or evaluated.
  • Command execution: none. No shell, exec, or process spawning.
  • Path handling: only static relative specifiers in import() calls, matching the existing catalogs. No dynamic path construction, no user-controlled segments.
  • Auth / secrets: untouched. No credentials, tokens, or network calls.
  • Dependencies: none added or upgraded.
  • IPC: untouched. No new channels or handlers.
  • Catalog content: pt.json is data consumed by i18next through the same lazy-loading path as es/ja/ko/zh, so it sits inside the existing trust boundary. Values are plain strings with i18next interpolation only — no HTML and no dangerouslySetInnerHTML involved.

Follow-up needed: none.

Notes

  • I could not exercise the language switch in a running app (see Testing). Confirmation from someone with a working build would be welcome.
  • CodeRabbit flags 0% docstring coverage. This PR adds no functions, so there is nothing to document; happy to revisit if a maintainer disagrees.
  • Open question: should the picker read Português (Brasil) or just Português? I went with the explicit form since the copy is pt-BR, but it is a one-line change either way.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 265a7536-480e-4c88-8420-36b415963878

📥 Commits

Reviewing files that changed from the base of the PR and between 73efab9 and 9b483a2.

📒 Files selected for processing (20)
  • config/scripts/bootstrap-locale-catalog.mjs
  • config/scripts/locale-translation-policy.mjs
  • config/scripts/repair-locale-catalog.mjs
  • src/main/i18n/main-i18n-lazy-locale.test.ts
  • src/main/i18n/main-i18n.ts
  • src/renderer/src/components/settings/appearance-search.test.ts
  • src/renderer/src/components/settings/appearance-search.ts
  • src/renderer/src/i18n/i18n.ts
  • src/renderer/src/i18n/lazy-locale.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/supported-languages.ts
  • src/shared/ui-language.test.ts
  • src/shared/ui-language.ts
  • src/shared/ui-locale.test.ts
  • src/shared/ui-locale.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/main/i18n/main-i18n.ts
  • src/shared/ui-locale.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/supported-languages.ts
  • src/shared/ui-language.ts
  • src/renderer/src/i18n/i18n.ts
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/zh.json

📝 Walkthrough

Walkthrough

Portuguese (pt) is added as a built-in UI language and supported locale. The language picker, search keywords, and existing locale catalogs receive Portuguese labels. Locale catalog scripts configure Brazilian Portuguese targets and cache handling. Renderer and main-process i18n loaders dynamically import the Portuguese catalog when selected. Tests cover language normalization, locale resolution, picker search, lazy loading, and Portuguese translations.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding the Brazilian Portuguese locale.
Description check ✅ Passed The description covers all template sections, explains incomplete test execution, and documents review, security, and platform considerations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@joaoguilhermesimon-collab

Copy link
Copy Markdown
Contributor Author

Este PR adiciona apenas registros de locale (duas arrow functions de uma linha em mapas de loader existentes) e um catálogo JSON. Não há funções que justifiquem docstrings, e as entradas de locale existentes também não têm.

@nwparker

nwparker commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Thank you for putting this together — and I am sorry it sat unanswered for so long, which is on us, not you.

We are not taking on new UI locales right now. Orca ships en/es/ja/ko/zh, and each one carries ongoing cost beyond the initial catalog: every new English string has to be re-translated, the build-time repair policy needs per-locale glossary and override rules, and mistranslations reach users in surfaces nobody on the team can read. We are currently working through a backlog of correctness bugs in the five we already ship, and adding a sixth before that is under control would not be fair to the people using it.

That is a decision about our capacity, not about the quality of your work. Closing so the queue reflects reality rather than leaving it open indefinitely — if that changes, this is easy to reopen and we will come back to the contributors who offered first.

Thanks again for the time you put in.

@nwparker nwparker closed this Aug 4, 2026
@nwparker

nwparker commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

I'm sorry — I closed this, and that was the wrong call. Reopening it.

The reasoning I gave (that we aren't taking on new built-in locales right now) is still true, but closing your PR was not the right way to act on it. You did the work, it sat for months without a reply, and then it got closed with an explanation of our constraints. That's a bad trade for you, and I apologize.

Here's what's actually going on. We do want these locales. What we can't currently take on is maintaining them in-tree, where every new English string becomes translation debt across every catalog and a mistranslation ships to users in a surface nobody on the team can read. So the direction we're working toward is the one where that maintenance sits with the people who actually speak the language: plugin language packs.

Most of that mechanism is already in the repo today:

  • a plugin manifest declares contributes.languagePacks: [{ locale, path }]
  • the pack is a plain catalog JSON with the same key shape as src/renderer/src/i18n/locales/en.json
  • packs are content-integrity verified and approval-gated at install, then registered into i18next at runtime
  • they appear in Settings → Appearance → Language next to the built-in locales
  • Intl formatting — dates, relative times, number formats — resolves through the locale tag the pack declares

The test fixture for that manifest contract uses pt-BR as its worked example, so this isn't hypothetical plumbing.

What's not there yet is the part that would make this pleasant for you: there's no authoring guide, no scaffolding to generate a starter catalog from en.json, no re-sync story when English strings change, and the glossary/repair tooling we use for the built-in locales isn't exposed to pack authors. That's the work in front of us. I'm not going to give you a date I can't keep.

I'd rather leave this open and come back to you when that lands than close it and have you find out from a changelog. If you'd prefer to close it yourself in the meantime, that's entirely your call — but it should be yours, not mine.

Thanks for the work, and sorry again for how I handled it.

Enables users to select Portuguese as their interface language. Includes
locale configuration, translation catalog management, language picker
integration, and comprehensive test coverage.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

AmethystLiang
AmethystLiang previously approved these changes Aug 10, 2026
@AmethystLiang
AmethystLiang dismissed their stale review August 10, 2026 07:48

Switching approach: Portuguese will ship as the official language plugin first, not as a first-party core locale. Dismissing approval while we redirect this work.

@AmethystLiang

Copy link
Copy Markdown
Contributor

Direction change: plugin-first for Brazilian Portuguese

Thanks for this work — the catalog and wiring quality is solid. After thinking through first-party vs plugin, we're going to start with the official language plugin and promote to a first-party core locale later once the pack is mature and the maintenance path is clear.

Please continue this in the plugin repo instead of core:

Plan

  1. Move the translation content from this PR (pt.json / related catalog work) into orca-portuguese so users get Portuguese via the language pack path.
  2. Keep first-party pt out of core for now (no competing built-in + plugin).
  3. Later, when coverage + ongoing sync look solid, we can promote the same catalog into a first-party locale (and migrate plugin selections → built-in).

I'll dismiss my approval so this PR isn't treated as merge-ready for core. Happy to help review PRs on the plugin repo as you port the strings over.

Sorry for the flip-flop — plugin-first keeps core lean while still giving Brazilian Portuguese a real official home.

@AmethystLiang

Copy link
Copy Markdown
Contributor

Thank you @joaoguilhermesimon-collab for contributing to Brazilian Portuguese support! Brazilian Portuguese is now checked into main as a built-in UI language via #31627, which also includes migration from the legacy Portuguese plugin.

I verified that you are credited as a commit co-author in the merged commit.

Closing this PR as superseded by the merged built-in support. Thank you for your work and patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants