Skip to content

feat(i18n): add Brazilian Portuguese (pt-BR) UI locale - #6526

Closed
janderson-fagner wants to merge 1 commit into
stablyai:mainfrom
janderson-fagner:feat/pt-br-locale
Closed

janderson-fagner wants to merge 1 commit into
stablyai:mainfrom
janderson-fagner:feat/pt-br-locale

Conversation

@janderson-fagner

@janderson-fagner janderson-fagner commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Adds Brazilian Portuguese (pt-BR) as a selectable UI language. It appears as "Português (Brasil)" in Settings → Appearance → Language and switches the interface live, like the other locales.

Why

Orca already supports en, es, ja, ko, and zh, but had no Portuguese option despite a sizeable Brazilian user base. This wires pt into the existing i18n infrastructure with full key parity.

Implementation

  • Register the pt locale across shared, renderer, and main i18n: shared/ui-language.ts, shared/ui-locale.ts, renderer/i18n/i18n.ts, main/i18n/main-i18n.ts, renderer/i18n/supported-languages.ts.
  • New src/renderer/src/i18n/locales/pt.json translation catalog with full key parity against en.json (same keys, same {{placeholders}}).
  • Add the portuguese language label key to every existing locale catalog.
  • Extend ui-locale.test.ts to cover the new locale.

Design note: the locale code is the 2-letter pt (consistent with the existing locales). normalizeSupportedUiLocale already splits on -, so system locales pt-BR / pt-PT resolve to pt. Content is Brazilian Portuguese; the in-UI label disambiguates as "Português (Brasil)".

Product names, CSS/keyframes, and URLs were intentionally left untranslated.

Visual change

Yes — a new entry in the language selector and the full UI in Portuguese when selected. Validated locally on Windows: selecting "Português (Brasil)" translates menus, the sidebar, Settings, and Source Control, with placeholders rendering correctly and proper accentuation. (Screenshots can be attached to the PR conversation.)

AI code review summary

  • Cross-platform (macOS/Linux/Windows): No platform-specific code paths added. Pure data (JSON catalog) plus locale registration shared by all platforms. No hardcoded path/keyboard assumptions introduced.
  • SSH/remote/local: i18n runs in the renderer and main process and is independent of where worktrees or runtimes live; no assumptions about local-only execution.
  • Agent/integration/git-provider: No provider- or agent-specific behavior touched; "Labels"/"Merged" kept in English to stay neutral across GitHub/GitLab review surfaces.
  • Performance: One additional locale bundle imported alongside the existing ones; no hot-path work added.
  • UI quality: Follows the existing language-selector pattern; label is the native language name like the other locales.
  • Security: No new inputs, network calls, or dynamic code. Static translation strings only.

Checks run

pnpm lint (incl. verify:localization-catalog parity + verify:localization-coverage), pnpm typecheck (node + web), and the i18n/locale test suite all pass.

ELI5

Brazilian Portuguese (pt-BR) is a full UI language option under Settings → Appearance → Language, same as English, Spanish, Japanese, and others.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Portuguese (pt) is added as a supported UI language. A new UI_LANGUAGE_PORTUGUESE constant is exported from src/shared/ui-language.ts, extending the UiLanguage type union and UI_LANGUAGE_VALUES set. SUPPORTED_UI_LOCALES in ui-locale.ts gains 'pt', and resolveUiLocale maps UI_LANGUAGE_PORTUGUESE to 'pt'. The pt locale JSON is imported and registered in both main and renderer i18n initialization. UI_LANGUAGE_CHOICES and UI_LANGUAGE_CHOICE_FALLBACKS in supported-languages.ts are extended with the Portuguese entry. All existing locale files (en, es, ja, ko, zh) receive a portuguese label key. Tests cover normalization, resolution, and renderer locale behavior for pt.

🚥 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 summarizes the main change: adding a Brazilian Portuguese UI locale.
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.
Description check ✅ Passed The PR description covers the change, rationale, implementation, validation, review summary, security, and notes, though it doesn’t use the exact template headings.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/shared/ui-language.ts (1)

7-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a short why comment for the canonical pt key.

Using plain pt here is a non-obvious product constraint: the UI exposes Brazilian Portuguese, while system locales like pt-BR and pt-PT normalize to this single catalog. A one-line comment here would make that contract much easier to preserve.

Proposed diff
-export const UI_LANGUAGE_PORTUGUESE = 'pt'
+// Why: Brazilian Portuguese ships under the canonical `pt` key, and
+// `pt-BR`/`pt-PT` system locales normalize to this single catalog.
+export const UI_LANGUAGE_PORTUGUESE = 'pt'

As per coding guidelines, **/*.{ts,tsx,js,jsx} files should add a short why comment when code is driven by a design doc or non-obvious constraint.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b1d00d1f-f091-4c70-a344-ecb23bc8626e

📥 Commits

Reviewing files that changed from the base of the PR and between 14f0096 and 4a633f750a0a398a6ed6927c338f3d1559d2f9af.

📒 Files selected for processing (12)
  • src/main/i18n/main-i18n.ts
  • src/renderer/src/i18n/i18n.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.ts
  • src/shared/ui-locale.test.ts
  • src/shared/ui-locale.ts

@AmethystLiang
AmethystLiang self-requested a review June 28, 2026 01:40
@AmethystLiang
AmethystLiang requested review from Jinwoo-H and removed request for AmethystLiang June 28, 2026 19:02
Add Portuguese (Brazil) as a selectable UI language, shown as
"Português (Brasil)" in Settings > Appearance.

- Register the `pt` locale across shared, renderer, and main i18n
  (ui-language, ui-locale, i18n.ts, main-i18n.ts, supported-languages).
- Add `pt.json` translation catalog with full key parity against en.json
  (placeholders preserved; product names, CSS, and URLs left untranslated).
- Add the `portuguese` language label key to all existing locale catalogs.
- Cover the new locale in ui-locale.test.ts.

The locale code stays a 2-letter `pt` to match the existing locales;
normalizeSupportedUiLocale maps pt-BR/pt-PT system locales to `pt`.
@ghost

ghost commented Jun 30, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 5 individual chapters for you:

Title
1 Define Portuguese language and locale constants
2 Add Brazilian Portuguese translation catalog
3 Register Portuguese in existing locale catalogs
4 Wire Portuguese into i18n loaders
5 Verify Portuguese locale resolution with tests
Open in Stage

Chapters generated by Stage for commit b9c5708 on Jun 30, 2026 11:54pm UTC.

@AmethystLiang AmethystLiang assigned OrcaWin and unassigned Jinwoo-H Jul 20, 2026
@AmethystLiang
AmethystLiang requested review from OrcaWin and removed request for Jinwoo-H July 20, 2026 18:43
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
@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.

@AmethystLiang

Copy link
Copy Markdown
Contributor

Thank you @janderson-fagner 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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants