Skip to content

feat(i18n): add Brazilian Portuguese (pt-BR) locale and localize hardcoded dashboard strings - #716

Open
fernandomarcius wants to merge 3 commits into
Egonex-AI:mainfrom
fernandomarcius:feat/pt-br-locale
Open

fernandomarcius wants to merge 3 commits into
Egonex-AI:mainfrom
fernandomarcius:feat/pt-br-locale

Conversation

@fernandomarcius

Copy link
Copy Markdown

Summary

Adds Brazilian Portuguese (pt-BR) as a supported output/UI language, and moves the dashboard's remaining hardcoded English strings into the locale files so every supported language renders a fully translated UI.

pt-BR locale

  • packages/dashboard/src/locales/pt-BR.ts — full UI translation; resolveLocaleKey maps pt, pt-BR, pt_br, portuguese, brazilian-portuguese → pt-BR.
  • skills/understand/locales/pt-BR.md — output guidelines (tags, summary style, technical terms, layer names) injected when --language pt-BR.
  • skills/understand/SKILL.md — portuguese now normalizes to pt-BR; a bare pt uses the pt-BR guidance file.
  • README + translated READMEs list pt-BR among supported languages (same pattern as feat(i18n): add Vietnamese (vi) locale support #709).

Hardcoded strings → locales (applies to all 8 locales, not only pt-BR)

  • 125 new keys (new sections graphNodes, graphView, loadErrors, staleness, nodeTypeNames, edgeCategoryNames), plus wiring of existing-but-unused keys (ariaLabels.*, nodeTypeFilter.*, tokenGate.*, warningBanner.*, projectOverview.simple/moderate/complex).
  • Complexity badges, node-type names, edge categories and edge labels are now localized via src/utils/i18nLabels.ts instead of rendering raw enum values (complex, LAYER, files, Click to explore →, …).
  • Count/interpolated messages are functions so each language can apply its own plural rules (e.g. Russian one/few/many); search.result → search.resultCount(n).
  • TokenGate renders before config.json is read, so it is wrapped in an I18nProvider that follows navigator.language; resolveLocaleKey now falls back to the base language (ja-JP → ja, ko-KR → ko).
  • locales.test.ts: the key-shape helper used to drop leaf keys, so it compared nothing; it now compares every leaf and its kind (string vs function) across all 8 locales.

Intentionally left in English: the "Copy Issues" payload (meant for GitHub/agents), core validator / elk-layout diagnostics, raw server/exception error details, theme preset names, key names in the shortcuts table, and console logs.

Linked issue(s)

None.

How I tested this

  • Ran /understand --language pt-BR flow on a ~560-file Rust workspace (3.8k nodes) and opened the dashboard: onboarding, persona selector, layer cards (CAMADA · Complexa · 29 arquivos · Clique para explorar →), filters, search, diff toggle, tour panel and code viewer all render in pt-BR; switching outputLanguage back to en restores English.

  • Same CI sequence locally, all green:

  • pnpm lint

  • pnpm --filter @understand-anything/core test (799 passed, 4 skipped)

  • pnpm test (1013 passed)

  • pnpm --filter @understand-anything/core build, @understand-anything/skill build, understand-anything-viewer build, dashboard tsc -b + vite build

  • python -m unittest tests.skill.understand.test_merge_batch_graphs tests.skill.understand.test_merge_subdomain_graphs tests.skill.knowledge.test_parse_knowledge_base (106 tests OK)

  • Manual smoke test (described above)

Versioning

Fernando Farias added 3 commits October 6, 2026 10:49
- dashboard: pt-BR UI strings, resolveLocaleKey maps pt / pt-BR / portuguese
- understand skill: pt-BR output guidelines; portuguese -> pt-BR
- README: list pt-BR among supported languages
- Move remaining user-visible English (token gate, path finder, learn panel,
  warning/staleness banners, export alerts, code viewer errors, graph node
  cards, empty states, load errors, aria-labels) into the locale files.
- Render complexity, node types, edge categories and edge types through
  localized labels (new nodeTypeNames/edgeCategoryNames sections and
  utils/i18nLabels helpers).
- Use functions for counted/interpolated messages so each locale can apply
  its own plural rules (e.g. Russian one/few/many).
- Add the new keys to en, zh, zh-TW, ja, ko, ru, vi and pt-BR.
- Token gate follows the browser language; locale resolution retries the
  base language for tags such as ja-JP.
- Locale shape test now compares leaf keys (and their kind) for every locale.

This branch has not been deployed

No deployments
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