Skip to content

feat(locale): add Portuguese (Portugal) — pt-PT#1512

Open
americodias wants to merge 3 commits into
getfider:mainfrom
americodias:feature/locale-pt-pt
Open

feat(locale): add Portuguese (Portugal) — pt-PT#1512
americodias wants to merge 3 commits into
getfider:mainfrom
americodias:feature/locale-pt-pt

Conversation

@americodias
Copy link
Copy Markdown
Contributor

Summary

Adds Portuguese (Portugal)pt-PT — as a distinct locale from the existing pt-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:

pt-BR pt-PT
você (formal imperative / implícito)
cadastrar registar
senha palavra-passe
arquivo ficheiro
tela ecrã
usuário utilizador
salvar guardar
excluir eliminar
gerenciar gerir
está fazendo está a fazer
planejado planeado
acessar aceder

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 of locale/en/client.json)
  • locale/pt-PT/server.json — 72 keys (full coverage of locale/en/server.json)
  • app/models/enum/locale.goLocalePortuguesePT (MessageFormatCode: "pt", PostgresConfig: "portuguese", LinguaLanguage: lingua.Portuguese, IsRTL: false) added to AllLocales immediately after LocalePortugueseBR
  • locale/locales.ts — entry added
  • lingui.config.js"pt-PT" added to locales array
  • public/ssr.tsx — pt-PT bundled for SSR

Validation

  • Strict placeholder/variable parity check vs locale/en — zero mismatches across all 308 strings (ICU {var}, {var, plural, one {…} other {…}}, <N/>, <N>…</N>, <strong> all preserved).
  • Translated from en/ (not from pt-BR), to avoid Brazilian-form residue.
  • Final grep for pt-BR-isms (você|cadastr|arquivo|tela|senha|salvar|excluir|gerenciar|usuário|planejad) — clean.
  • go build ./... — passes
  • npx lingui compile — passes (compiled locale/pt-PT/client.js cleanly)
  • npx eslint locale/ public/ssr.tsx — clean
  • go test ./app/pkg/i18n/... ./app/actions/... -short — pass
  • Production smoke test: this locale has been running on a self-hosted Fider deployment (v0.34.0 + this patch) since 2026-04-27 — UI renders correctly across home, post detail, comment input, sign-in, modals, settings.

Notes for reviewers

  • Two ICU plural forms in 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).
  • The lingua-go library doesn't distinguish pt-BR/pt-PT — both share lingua.Portuguese. This means automatic language detection will continue to return whichever appears first in AllLocales (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.title and feed.post.title are translated even though most other locales (pt-BR, es-ES, fr) currently lack these keys. They exist in en/ so I've included them.

Happy to adjust register/word choices if maintainers prefer different conventions.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant