Repository navigation
feat(i18n): add Brazilian Portuguese (pt-BR) interface language - #79
Merged
Merged
Conversation
Adds a third interface language next to English and Traditional Chinese.
The pt-BR catalog translates the same 448 English source keys as zh-TW,
keeps every {placeholder} intact and is wired through the existing
locale cookie, server action and provider — no new dependency, schema
or worker change.
A `satisfies` check makes a missing pt-BR key a compile error, and a
test pins the pt-BR key set to the zh-TW one so the catalogs cannot
drift apart.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PEPFq6M4tCRdtCgXbnRt5a
|
Someone is attempting to deploy a commit to the diwenne's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
What
Adds Brazilian Portuguese (
pt-BR) as a third interface language, next to English and Traditional Chinese.Brazil is one of Instagram's largest markets and comment-to-DM is a very common growth tactic for Brazilian creators, agencies and small businesses. Most of them run ManyChat today, and a Portuguese interface makes OpenReply usable for teams that don't work in English.
How
It follows the existing localization design in
docs/localization.mdexactly, with no new mechanism:lib/i18n/pt-BR.jsonzh-TW.json, same order.lib/i18n/index.tsLocalebecomes"en" | "zh-TW" | "pt-BR";isLocaleacceptspt-BR;t()looks the message up in a smallcatalogsmap instead of thezh-TWternary.components/language-switcher.tsxPortuguês (Brasil)option (withlang="pt-BR").__tests__/i18n.test.ts__tests__/i18n-actions.test.tsdocs/localization.md,README.mdUnchanged on purpose: the cookie name and flags, the server action, the provider, English as the fallback, and everything outside the interface-translation scope (marketing pages, legal pages, auth emails, campaign content, the worker). No new dependency, no schema change.
Keeping the catalogs in sync
The catalogs could drift as new UI copy lands, so this PR adds two guards:
ptBRCatalog satisfies Record<MessageKey, string>. A key that exists inzh-TW.jsonbut is missing frompt-BR.jsonbecomes a typecheck error, not anundefinedat render time.keeps the Brazilian Portuguese catalog on exactly the same keyscompares the two key sets, which also catches a stale extra key after copy is removed.The existing test
has complete, plain-text translations with matching interpolation fieldsnow runs over both catalogs. So every pt-BR entry is non-empty, plain text, and keeps exactly the same{placeholders}as its English key.Translation notes
" (capped at {count})"→" (máximo de {count})", and"You: "→"Você: ").Seg/Ter/Qua/Qui/Sex/Sáb/Dom.Checks
npm testnpm run lintnpm run typecheckmainand unrelated to this PR:lib/queue/dm-worker.ts(855,7): Type 'string | null' is not assignable to type 'string'(introduced by 257e38d; CI onmainis red for the same reason). Nothing else is reported, including in the i18n files.npm run buildmainby the samedm-worker.tstype error. I built and ran this same i18n change on top of086c155(the last greenmain), in a self-hosted Docker deployment.Manual verification (self-hosted instance)
openreply-locale=pt-BRcookie, the sign-in page is server-rendered in Portuguese ("Entrar", "Enviar um link mágico por e-mail") and the localized wrapper carrieslang="pt-BR".I have not yet walked through the full browser checklist in
docs/localization.md(the draft-survives-switch and narrow-viewport steps). I'll report back here once I have.Maintenance
I'm happy to keep
pt-BR.jsonup to date as new UI copy lands. Feel free to ping me on any PR that adds keys.