Skip to content

feat(desktop): add Brazilian Portuguese (pt-BR) locale (i18n) - #76863

Open
celsocba1 wants to merge 1 commit into
NousResearch:mainfrom
celsocba1:feat/pt-br-desktop-i18n
Open

feat(desktop): add Brazilian Portuguese (pt-BR) locale (i18n)#76863
celsocba1 wants to merge 1 commit into
NousResearch:mainfrom
celsocba1:feat/pt-br-desktop-i18n

Conversation

@celsocba1

Copy link
Copy Markdown

Summary

Adds complete Brazilian Portuguese (pt-BR) localization for the desktop app.

  • New apps/desktop/src/i18n/pt.ts — full translation of en.ts:
    2,967 lines / 2,003 keys, 100% parity with the current main en.ts
    (generated structurally from en.ts, so every key exists — no missing or
    extra keys).
  • Registers pt in types.ts (Locale union), languages.ts
    (LOCALE_OPTIONS entry "Português" + aliases: pt, pt-br, pt_br,
    pt-pt, pt_pt, portuguese, português), and catalog.ts (TRANSLATIONS).
  • The translation was built and validated on the v0.17.0 desktop app
    (2,958-line en.ts, 2,713 keys) and then re-synced against current
    main
    — including the 8 newer keys (terminalFont*,
    sshRemoteProfile*, openDirective).
  • Uses the existing defineLocale() pattern — untranslated future keys fall
    back to English automatically.

Testing

  • vitest src/i18n/languages.test.ts — 4/4 pass
  • vitest run --project ui src/i18n/28/28 pass
    (languages, runtime, plugin-i18n, context — includes the new pt locale)
  • npm run build — clean (11.2s), pt-BR strings present in bundle
  • Manual: packaged AppImage, UI opens in Portuguese, "Português" selectable
    under Settings → Language, persists across restarts (verified on v0.17.0)

Files changed (4)

File Change
apps/desktop/src/i18n/pt.ts new — full pt-BR translation
apps/desktop/src/i18n/types.ts +'pt' to Locale union
apps/desktop/src/i18n/languages.ts +LOCALE_OPTIONS entry + aliases
apps/desktop/src/i18n/catalog.ts +pt import + TRANSLATIONS entry

Note: previous attempts (#38846 — 15-language hybrid JSON+TS, 522 files; #40439
pt-BR) were closed unmerged. This is a minimal change matching the current main
structure (2-space indent, Translations type, LOCALE_OPTIONS with
englishName).

Full pt-BR translation of en.ts: 2967 lines, complete key parity with
main. Registers 'pt' in Locale union, LOCALE_OPTIONS (+aliases) and
TRANSLATIONS. Untranslated future keys fall back to English via
defineLocale pattern. i18n suite: 28/28 pass.

Closes NousResearch#40239
@alt-glitch alt-glitch added type/feature New feature or request comp/desktop Electron desktop app (apps/desktop/*) area/i18n Localization, locales, translations P3 Low — cosmetic, nice to have needs-decision Awaiting maintainer decision before any implementation labels Aug 2, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #65064 also wires desktop pt-BR for #40239, but its locale file is an English-placeholder skeleton while this PR supplies a complete translation. Please choose the desired desktop implementation rather than treating them as duplicates.

@teknium1 teknium1 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.

Thanks for the focused pt-BR desktop locale contribution. The feature is still absent from current main: apps/desktop/src/i18n/types.ts:8, languages.ts:7-38, and catalog.ts:8-14 register no pt locale. The PR's wiring follows the existing defineLocale() fallback pattern.

Problems

  • The new aliases and persisted pt value lack regression coverage. Current apps/desktop/src/i18n/languages.test.ts:6-46 tests normalization, recognition, and config values for every existing locale, but this diff changes no tests. The comparable Arabic locale commit 5b6990e7a056 added those tests.

Suggested changes

  • Add pt / pt-BR alias normalization, exact-locale recognition, supported-config-alias, and persisted-config-value assertions to apps/desktop/src/i18n/languages.test.ts.

Automated hermes-sweeper review.

العربية: 'ar'
العربية: 'ar',
pt: 'pt',
'pt-br': 'pt',

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.

Please add regression coverage in languages.test.ts for pt-BR normalization and the corresponding pt exact-id/config-value behavior. Existing locale additions, including Arabic in 5b6990e7a056, extend these tests.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Aug 2, 2026
@lucasmariano003-wq

Copy link
Copy Markdown

I reviewed and tested this PR on top of 300ac75ef and prepared a focused follow-up patch that addresses the requested regression coverage plus a few pt-BR integration and copy-quality gaps.

It:

  • adds regression coverage for pt, pt-BR, pt_br, and pt-PT normalization/persistence;
  • keeps the initial intro card and composer placeholders localized when the locale changes;
  • fixes PT-BR pluralization, terminology consistency, and naturalness;
  • adds focused tests for config-driven locale loading and localized intro/composer copy.

Patch (secret/unlisted Gist): https://gist.github.com/lucasmariano003-wq/bd5fbadc949faee701380e8301c01601

Raw patch: https://gist.githubusercontent.com/lucasmariano003-wq/bd5fbadc949faee701380e8301c01601/raw/d81cd1f8511ac2992669940cf708030d293166c4/hermes-desktop-ptbr-polish.patch

SHA-256: d6c9fa7fbb830e956381301bcc864a5256456ac25177f32878e024461342d5d3

Verified to apply cleanly to PR head 300ac75ef.

Validation:

  • targeted i18n/chat Vitest suites: 35/35 passed
  • npm run typecheck
  • npm run lint
  • npm run build
  • Electron Playwright pt-BR smoke test: 1/1 passed

The Gist contains a format-patch that can be applied with git am. I kept this as an incremental patch on the existing PR rather than opening a competing localization PR.

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

Labels

area/i18n Localization, locales, translations comp/desktop Electron desktop app (apps/desktop/*) needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants