feat(locale): add Portuguese (Portugal) — pt-PT#1512
Open
americodias wants to merge 3 commits into
Open
Conversation
Adds a Portuguese (Portugal) locale, distinct from the existing pt-BR. Translations follow pt-PT conventions: AO90 spelling, formal imperative register, "registar/utilizador/ficheiro/ecrã/palavra-passe/iniciar sessão" instead of pt-BR equivalents. - locale/pt-PT/client.json — 233 keys translated from en/ - locale/pt-PT/server.json — 72 keys translated from en/ - app/models/enum/locale.go — register LocalePortuguesePT (PostgresConfig "portuguese", MessageFormatCode "pt", LinguaLanguage Portuguese) - locale/locales.ts — add "pt-PT" entry - lingui.config.js — add "pt-PT" to locales array - public/ssr.tsx — bundle pt-PT messages for SSR Validated: go build ./..., npx lingui compile, i18n + tenant tests pass. Note: lingua-go does not distinguish pt-BR/pt-PT, so language detection will continue to return pt-BR (first match in AllLocales). Users select their locale explicitly via Site Settings, so this is not user-visible.
The subject template shares the template set with the HTML body and is rendered via html/template, which escapes '+' '"' '&' '<' '>' to their numeric entities (e.g. '&getfider#43;' '&getfider#34;'). SMTP headers are plain text and clients do not decode HTML entities in them, so subjects arrive at the inbox as for example: [Plataforma da Encontrar&getfider#43;se] Two columns of &getfider#34;status&getfider#34; Run html.UnescapeString on the extracted subject inside RenderMessage so the literal characters reach the mail client. Body rendering is unchanged. Test reproduces the bug on main and passes with the fix.
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 Portuguese (Portugal) —
pt-PT— as a distinct locale from the existingpt-BR(Brazilian Portuguese).Although both share the same root language, the two variants differ enough in everyday vocabulary, spelling, and register that pt-BR reads awkwardly to European Portuguese users. Examples of substitutions applied:
Spelling follows the Acordo Ortográfico de 1990 (AO90): atual, contacto, facto, adoção. Register is consistently formal-imperative (3rd person: Selecione, Introduza, Clique) to avoid the tu/você split entirely.
What's included
Following
locale/README.md:locale/pt-PT/client.json— 236 keys (full coverage oflocale/en/client.json)locale/pt-PT/server.json— 72 keys (full coverage oflocale/en/server.json)app/models/enum/locale.go—LocalePortuguesePT(MessageFormatCode: "pt",PostgresConfig: "portuguese",LinguaLanguage: lingua.Portuguese,IsRTL: false) added toAllLocalesimmediately afterLocalePortugueseBRlocale/locales.ts— entry addedlingui.config.js—"pt-PT"added tolocalesarraypublic/ssr.tsx— pt-PT bundled for SSRValidation
locale/en— zero mismatches across all 308 strings (ICU{var},{var, plural, one {…} other {…}},<N/>,<N>…</N>,<strong>all preserved).en/(not from pt-BR), to avoid Brazilian-form residue.você|cadastr|arquivo|tela|senha|salvar|excluir|gerenciar|usuário|planejad) — clean.go build ./...— passesnpx lingui compile— passes (compiledlocale/pt-PT/client.jscleanly)npx eslint locale/ public/ssr.tsx— cleango test ./app/pkg/i18n/... ./app/actions/... -short— passNotes for reviewers
server.json(feed.post.title,feed.post.footer) translate the words inside the plural arms —one {# voto} other {# votos},one {# comentário} other {# comentários}. Matches the en/ source semantically; existing pt-BR/es-ES/fr left these in English (probably oversight rather than intentional).lingua-golibrary doesn't distinguish pt-BR/pt-PT — both sharelingua.Portuguese. This means automatic language detection will continue to return whichever appears first inAllLocales(pt-BR, by design — pt-BR was here first and detection-by-content shouldn't silently switch existing users). Users explicitly select pt-PT via Site Settings → Manage → Default Language. Acceptable trade-off; documented.feed.global.titleandfeed.post.titleare translated even though most other locales (pt-BR, es-ES, fr) currently lack these keys. They exist inen/so I've included them.Happy to adjust register/word choices if maintainers prefer different conventions.