Skip to content

feat: add Brazilian Portuguese to the Console - #83

Merged
Vonng merged 6 commits into
pgsty:mainfrom
EduardoAndradeMachado:feat/i18n-pt-br
Nov 9, 2026
Merged

Vonng merged 6 commits into
pgsty:mainfrom
EduardoAndradeMachado:feat/i18n-pt-br

Conversation

@EduardoAndradeMachado

@EduardoAndradeMachado EduardoAndradeMachado commented Nov 6, 2026 •

Copy link
Copy Markdown

Contribution Licensing (no CLA, inbound=outbound, DCO required)

This pull request contributes to PGSTY SILO Console (pgsty/silo-console).
Code contributions are accepted under
GNU AGPL v3.0 or later
(AGPL-3.0-or-later), the same license as SILO Console.
By submitting this pull request I represent that I have the right to contribute
the changes under that license and retain copyright in my original work.
No CLA, copyright assignment, or separate Apache-2.0 license grant is required.
Existing copyright and license notices remain intact; separately licensed
material keeps its applicable terms. Every commit must carry a DCO
Signed-off-by trailer (git commit -s); see
CONTRIBUTING.md.

Description and motivation

Adds a complete Brazilian Portuguese translation of the Console. The decisions below are yours to make.

  • pt.ts, ptHelp.ts and ptScreens.ts mirror the three Chinese dictionaries, with all 2,249 keys covered. No English source strings changed.
  • i18n-coverage and public-locale now also cover Portuguese, including a check that the Console entry registers the feature copy of each translated language.
  • A second commit loads the Portuguese dictionaries on demand, so other languages don't pay for them. See question 1.
  • Hard-coded zh-CN date and number formatting goes through localeTag().
  • The page toggle became a cycle: en → zh → pt → en. English stays the default, and the stored language is validated.

The new files keep the Pigsty notice because they are translations of your dictionaries. Tell me if you prefer something else.

I prepared this translation with AI assistance. Corrections from other Brazilian Portuguese speakers are welcome.

Questions for maintainers

  1. On-demand loading. With the first commit alone, login's initial JS goes from 239.22 KB to 258.61 KB, still under the 259 KB limit but with only 0.39 KB to spare, and ConsoleKBar grows from 94.30 KB to 133.73 KB for every user. The second commit (feat: load Portuguese dictionaries on demand) fetches pt and ptHelp only when Portuguese is stored or chosen, and ptScreens only when the Console opens in Portuguese. With it, login is 239.78 KB and ConsoleKBar is 94.32 KB. The language changes immediately and the store loads the catalogue, so a slow or failed download never blocks the UI: first paint waits at most 1.5 s, English shows meanwhile, and a late catalogue re-renders mounted copy through a new system.catalogRevision. Chinese still loads up front as before. If you'd rather keep everything eager, drop that commit: the first one stands on its own.
  2. Language selector. With three languages, an English user passes through Chinese to reach Portuguese. A Chinese user no longer sees "Switch to English" on the toggle and needs two clicks to return. A small menu fixes both, but it changes three screens and their tests and adds to the bundle. Keep the cycle, or move to a menu?
  3. Embedded assets. web-app/README.md asks for a separate web: rebuild embedded GUI assets commit. This PR does not touch build/, so the embedded binary won't include Portuguese yet. Should I add that commit, or do you prefer to generate it?

Validation

Run on Linux with Node 24.22.1 (.nvmrc), on a 2 vCPU VM:

  • yarn typecheck, check-deadcode.sh, check-prettier.sh and check-warnings.sh passed.
  • yarn build and yarn check:bundle passed: 258.61 KB with the first commit, 239.78 KB with both.
  • language-catalog, i18n-coverage, public-locale, iam-browser and responsive.unit with both commits passed.
  • Unit project flakiness, please read. The base commit had 3 clean full runs out of 3 (753 tests). This branch had no clean full run out of 5, with 1 to 4 failures each, and the tests differ between runs. Trace ... at 768px en dark failed the hover-tooltip assertion in 3 runs; the others were acceptance-forms:455, preview-renderers:156, bucket-usage-refresh:245 and ff-controls:50 and :531. All 761 tests passed at least once on this branch, and each failed test passed when re-run. In the last full run, on the final code, 760 passed and 1 failed (ff-controls:531, which then passed 5 of 5).
  • I could not reproduce the Trace failure by repeating it under CPU load (16 of 16 on each side) or with only the two files active at that moment (3 of 3). I don't know the cause, and nothing in this diff touches those components, but with these numbers I can't say it is unrelated to this branch. All runs used a 2 vCPU VM.
  • iam.spec.ts and responsive.spec.ts were changed but not run, because they need a running server.
  • A download that stalls, arrives late or fails was checked on the real app with intercepted requests: login opens in English, the toggle keeps working, and late copy appears without a reload. Only the stalled and late cases are covered by language-catalog, through the screen loader. After a failed download, Portuguese retries when the language changes again or on reload, and whether a browser refetches a failed import() depends on its version.

Manual check: 37 routes at 1440, 768 and 350x700 in Portuguese against a real SILO (RELEASE.2026-10-26), read-only, with no horizontal overflow. This covered each route's initial state, not dialogs or detail pages.

Screenshots of the login in Portuguese at 1440 and 350:

Login in Portuguese at 1440

Login in Portuguese at 350

With the second commit, I also checked in the browser that English never requests the Portuguese files, that cycling to Portuguese downloads them and switches the text, and that a stored pt shows Portuguese on first paint.

Compatibility and documentation impact

Frontend only, with no API, permission or SILO integration changes. The default language stays English, and existing en and zh preferences keep working. The root README.md now lists the three languages.

Checklist

  • All commits are signed off (git commit -s) per the DCO
  • Relevant tests and checks pass
  • Compatibility and UI impact documented
  • Public documentation update opened in pgsty/silo.pgsty.com, if needed

Add pt, ptHelp and ptScreens dictionaries mirroring the Chinese ones,
cycle the page toggle through en, zh and pt, and route hard-coded
zh-CN formatting through localeTag(). English stays the default and
the stored language is validated.

Extend i18n coverage and public-locale tests to Portuguese and list the
three languages in the README.

Signed-off-by: EduardoAndradeMachado <[email protected]>
Keep pt, ptHelp and ptScreens out of the login and Console chunks. The
language changes immediately and the store loads its catalogue on every
language change, so a stalled or failed download never blocks the UI.

First paint and the Console wait at most 1.5 s. English shows meanwhile,
and a late catalogue re-renders mounted copy through catalogRevision.
A failed download is retried on the next language change or reload.

Signed-off-by: EduardoAndradeMachado <[email protected]>
@EduardoAndradeMachado
EduardoAndradeMachado marked this pull request as ready for review November 6, 2026 21:35
@Vonng
Vonng merged commit e6d8e19 into pgsty:main Nov 9, 2026
13 checks passed
Vonng added a commit that referenced this pull request Nov 9, 2026
Replace the language cycle and Portuguese-only asynchronous loader with a shared dropdown and static locale registry. English remains the default and fallback; Chinese coverage is mandatory. Add French, German, Russian, Spanish, Japanese, Arabic and Turkish while preserving the Portuguese contribution from #83.

Use locale-aware formatting and plural rules, mirror UI layout for Arabic, and isolate raw protocol data. Add catalog validation, contextual coverage and safe key migration tooling. Language switching works offline and preserves form state.

Implements pgsty/silo#277. Validated with 775 frontend unit tests, 18 targeted layout/tooling tests, 14 final catalog regressions, type checking, formatting, dead-code checks, TestCafe TypeScript 4.9 compilation, and production bundle budgets.

Signed-off-by: Feng Ruohang <[email protected]>
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.

2 participants