feat(i18n): add Brazilian and European Portuguese locales (pt-BR, pt-PT)#579
Open
prenansantana wants to merge 4 commits into666ghj:mainfrom
Open
feat(i18n): add Brazilian and European Portuguese locales (pt-BR, pt-PT)#579prenansantana wants to merge 4 commits into666ghj:mainfrom
prenansantana wants to merge 4 commits into666ghj:mainfrom
Conversation
Add pt-br and pt-pt as separate locales to cover both Portuguese variants
(~260M speakers combined). Replaces the orphan generic 'pt' entry in
languages.json that had no matching translation file.
- locales/pt-br.json: Brazilian Portuguese (633 strings)
- locales/pt-pt.json: European Portuguese with PT vocabulary
(ficheiros, utilizador, rondas, inquérito, factos) and infinitive
constructions ("A carregar", "A gerar")
- locales/languages.json: register pt-br and pt-pt with localized labels
and llmInstruction values for backend prompts
Add README-PT-BR.md and README-PT-PT.md alongside the existing English and Chinese versions. Update navigation links across all 4 README files so users can switch between language variants.
Users who previously selected Portuguese have 'pt' stored in localStorage. Without this guard, they would silently fall back to Chinese after the 'pt' key was replaced by 'pt-br'/'pt-pt'.
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 Brazilian Portuguese (
pt-br) and European Portuguese (pt-pt) as separate locales, expanding language coverage to ~260M Portuguese speakers across Brazil, Portugal, and Lusophone Africa.This also fixes a silent bug:
locales/languages.jsonhad a"pt"entry with no matching translation file, so it never appeared in the language dropdown —frontend/src/i18n/index.jsonly registers locales whose JSON file exists. This PR replaces the orphan entry with two functional ones.Why two variants instead of one generic
pt?The two Portuguese variants have meaningful differences in vocabulary, spelling, and idiomatic forms:
A single generic
pt.jsonwould feel awkward to roughly half of users. Keeping them separate matches how vue-i18n projects typically handle this. If maintainers prefer a single locale, happy to consolidate.Changes
locales/pt-br.json— 633 strings (Brazilian Portuguese)locales/pt-pt.json— 633 strings (European Portuguese, AO90 spelling where applicable)locales/languages.json— replace orphanptwithpt-brandpt-pt, both with localizedlabelandllmInstructionfieldsREADME-PT-BR.mdandREADME-PT-PT.md— translated READMEsREADME.mdandREADME-ZH.md— language navigation bar updated to include the new variantsHow it works
Zero code changes:
import.meta.glob('../../../locales/!(languages).json')infrontend/src/i18n/index.jsos.listdir(_locales_dir)inbackend/app/utils/locale.pyLanguageSwitcher.vuerenders fromavailableLocales, no hardcoded listThe new locales appear in the dropdown automatically and the backend resolves them via the
Accept-Languageheader.Validation
en,pt-br,pt-pt) have exactly 633 strings and identical key structure (verified programmatically)Notes for maintenance
When new keys are added to
en.json, bothpt-br.jsonandpt-pt.jsonwill need the corresponding translations. Consider documenting this inCONTRIBUTING.mdif i18n contributions become regular.