feat(i18n): add Brazilian Portuguese (pt-BR) locale - #195
Conversation
Adds a complete pt-BR translation of all 509 keys, following the same shape as the existing locales (typed against I18nDictionary, registered in LOCALE_DEFINITIONS with dateLocale pt-BR). Translated from en.ts, using es.ts as a reference for house tone and button phrasing. Brazilian rather than European Portuguese throughout (usuario/arquivo/tela/gerenciar/baixar, "voce" not "tu"). Placeholders, emoji and escape sequences preserved exactly; button labels kept short so they still fit on mobile. Technical terms Brazilian users normally keep in English are left alone (OpenCode, commit, worktree, token, MCP). Two existing tests used "pt" as their example of an *unsupported* locale, so adding Portuguese made them fail. Both now use "xx", which is unassigned in ISO 639 and -- unlike ko/tr/he, which have open locale PRs -- is unlikely to become real later. Test intent is unchanged. Also added positive assertions that "pt" and "pt-BR" resolve to "pt", mirroring the existing ru-RU/fr-FR cases. Verified locally: vitest 1189/1189 pass, tsc typecheck clean (which is what proves key parity against I18nDictionary), eslint --max-warnings=0 clean, prettier clean, build clean.
|
@barrymac thanks for contribution Two things to fix before merge:
Minor: pt.ts:148-149 — "edit" left in English while "draft (experimental)" was translated; make the pair consistent. Also "Session was reset" appears as both redefinida (projects.selected) and reiniciada (worktree.selected). |
Summary
Adds a complete Brazilian Portuguese (
pt-BR) locale — all 509 keys, following the same shape as the existing locales: typed againstI18nDictionary, registered inLOCALE_DEFINITIONSwithdateLocale: "pt-BR", selectable viaBOT_LOCALE=ptor the settings menu.Portuguese is the sixth most-spoken language in the world and Brazil is a large Telegram market, so this felt like a worthwhile gap to close. Happy to adjust any wording if a native-speaker reviewer disagrees with a choice.
Translation approach
en.ts; used the existinges.tsas a reference for house tone and button phrasing rather than translating from Spanish.usuário(notutilizador),arquivo(notficheiro),tela(notecrã),gerenciar(notgerir),baixar(notdescarregar). Usesvocê, consistently.{placeholder}, emoji and\nescape preserved exactly.OpenCode,commit,worktree,token,prompt,MCP,log,bash,cron. LikewiseStatus:anddetached HEAD, which are identical in practice.Heads-up: two existing tests had to change
This is the only part of the diff that isn't purely additive, so flagging it explicitly.
Two tests used
"pt"as their example of an unsupported locale, so adding Portuguese made them fail:tests/i18n/index.test.ts—expect(normalizeLocale("pt", "en")).toBe("en")tests/config.test.ts—vi.stubEnv("BOT_LOCALE", "pt")Both now use
"xx", which is unassigned in ISO 639 and — unlikeko,trorhe, which all have open locale PRs — is unlikely to ever become a real locale here. The intent of both tests is unchanged.I also added two positive assertions that
"pt"and"pt-BR"resolve to"pt", mirroring the existingru-RU/fr-FR/en-UScases in the same test.Verification
Run locally against this branch:
vitest runtsc -p tsconfig.test.json --noEmiteslint src tests --max-warnings=0prettier --checktsc(build)The typecheck is the meaningful one for key parity: because
ptis declared asI18nDictionary, any missing or extra key fails compilation. I additionally verified programmatically that the key list is byte-identical toen.tsin both content and order, and that every{placeholder}token matches its English counterpart one-for-one.