feat(i18n): add Brazilian Portuguese (pt-BR) locale - #195
Open
barrymac wants to merge 1 commit into
Open
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.
Owner
|
@barrymac please update README.md and env.example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.