Improve Portuguese localization and add Brazilian Portuguese (pt-BR)#6076
Improve Portuguese localization and add Brazilian Portuguese (pt-BR)#6076thristhart wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
ℹ️ Minor suggestions inline — one regression in the pt.ts rewrite and a docs typo.
Reviewed changes — rewrites the European Portuguese locale to use article-aware translations and adds a new Brazilian Portuguese locale.
- Rewrite
pt.ts— switches from bare-type-nameTypeDictionaryentries to article-aware{ name, articles }objects; addstranslateOriginWithArticlehelper; fixesunrecognized_keys(now says "inválida" instead of "desconhecida"); addsinvalid_uniondiscriminator-options message; adds missingmacformat entry. - Add
pt-BR.ts— new Brazilian Portuguese locale with the same article-aware structure as the rewrittenpt.ts, using Brazilian lexical variants (registro/arquivo/tuplavsregisto/ficheiro/tuplo). - Register
ptBRin the locale barrel and docs.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| } | ||
| return `Tipo inválido: esperado ${expected}, recebido ${received}`; | ||
| const received = translateOriginWithArticle(receivedType, "indefinite"); | ||
| return `Entrada inválida: esperava ${expected}, recebeu ${received}`; |
There was a problem hiding this comment.
The instanceof check (if (/^[A-Z]/.test(issue.expected))) was dropped from the invalid_type case. When the expected type is a class name like Date, the old code produced "esperado instanceof Date"; now it falls through to the generic "esperava" message with the fallback "um valor "Date"". Same gap in pt-BR.ts.
| const expected = translateOriginWithArticle(issue.expected, "indefinite"); | ||
| const receivedType = util.parsedType(issue.input); | ||
| const received = translateOriginWithArticle(receivedType, "indefinite"); | ||
| return `Entrada inválida: esperava ${expected}, recebeu ${received}`; |
There was a problem hiding this comment.
Missing instanceof handling — same as in the rewritten pt.ts. When issue.expected is a constructor name (starts with uppercase), en.ts routes to an "expected instanceof …" message; neither locale handles this path.
There was a problem hiding this comment.
en.ts had the instanceof handling reverted in bf6d99e, so just following the current approach
| - `ps` — Pashto | ||
| - `pl` — Polish | ||
| - `pt` — Portuguese | ||
| - `ptBR` — Brazillian Portuguese |
There was a problem hiding this comment.
Typo: Brazillian → Brazilian (single 'l').
There was a problem hiding this comment.
ℹ️ Docs typo fixed in the follow-up commit — the
invalid_typeinstanceofconcern remains for both locale files (preexisting feedback).
Reviewed changes — formatting follow-up that fixes the "Brazillian" typo and adds trailing newlines.
- Typo fix —
Brazillian→Brazilianin the docs locale table. - Trailing newlines — added missing EOF newlines in
pt-BR.tsandpt.ts.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
In the process of working on a pt-BR translation, our localizers noticed some issues around the usage of articles with the existing Portuguese localization, so we're fixing those while we're here. Let me know if you'd rather have this as two separate PRs.