Skip to content

fix(i18n): translate the home Recent Requests panel and topology legend - #12551

Open
pacocartones wants to merge 2 commits into
diegosouzapw:release/v3.8.51from
pacocartones:fix/i18n-home-recent-requests-topology
Open

fix(i18n): translate the home Recent Requests panel and topology legend#12551
pacocartones wants to merge 2 commits into
diegosouzapw:release/v3.8.51from
pacocartones:fix/i18n-home-recent-requests-topology

Conversation

@pacocartones

Copy link
Copy Markdown
Contributor

Summary

  • On a non-English dashboard the home page mixed languages in the two live widgets. The "Recent Requests" panel (src/app/(dashboard)/home/HomeRecentRequests.tsx) already reads every label through useTranslations("home"), but the five keys it uses (home.recentRequests, recentRequestsEmpty, recentRequestsModel, recentRequestsTokens, recentRequestsWhen) shipped in feat(home): add Recent Requests panel + excludeTests allowlist fix #10900 as verbatim English copies in 39 of the 41 non-English catalogs (only pt-BR and vi were translated). A verbatim copy is invisible to every i18n gate: check-ui-keys-coverage counts it as covered, sync-ui-keys only backfills absent keys, and check-ui-value-drift only sees English values that change. So the panel rendered "RECENT REQUESTS / Model / In / Out / When" in es, fr, de, it, ja and every other locale.
  • The Provider Topology legend (src/app/(dashboard)/dashboard/HomeProviderTopologySection.tsx) borrowed three labels from unrelated namespaces: common.active, settings.recent (the memory-retrieval "Chronological window" toggle, itself an English copy in 33 locales) and analytics.modelStatusError (lower-case "error" in es). The result in Spanish was "Activo · Recent · error" under a Spanish title.
  • Fix: the legend now owns its three labels, home.topologyLegendActive / topologyLegendRecent / topologyLegendError, next to the home.activeError subtitle they sit under, with consistent capitalisation per locale. The recent-requests keys get real translations in es, pt, fr, de and it (pt-BR and vi were already correct); the legend keys are translated in es, pt, pt-BR, fr, de, it and vi. Every other locale gets the repo's __MISSING__:<english> marker (the form feat(admin): localize the anomalies page and add it to the sidebar #12401 used for new keys) instead of a silent English copy — the runtime still falls back to English there, but the keys are now visible to i18n:sync-ui --translate-markers. Where a locale already had a translated common.active / settings.recent / analytics.modelStatusError, that translation is reused for the legend rather than a marker (54 reused, 48 markers across the 34 locales I did not translate by hand). No English value changed, so the value-drift gate is unaffected.
  • Deliberately out of scope (same root cause, different surface, kept for a follow-up so this PR stays one defect): the FirstRunReadinessCard home.readiness* keys (10) plus home.stepError, home.requestsShort, home.aliasLabel are also English copies in es and most locales; analytics.modelStatusError is still lower-case "error" in es on the analytics page; settings.recent remains an English copy in 33 locales on the memory settings tab.

Before / after (es-ES)

Before:

RECENT REQUESTS                     Topología del proveedor
Model      In / Out      When        0 activo · 1 error     ● Activo  ● Recent  ● error
No requests yet.

After:

SOLICITUDES RECIENTES               Topología del proveedor
Modelo     Entrada / Salida  Cuándo  0 activo · 1 error     ● Activo  ● Reciente  ● Error
Aún no hay solicitudes.

Related Issues

  • No open issue covers this (gh issue list --search "recent requests i18n" / --search topology return unrelated backlog items).

Validation

  • Change type: i18n / UI
  • Focused tests and category gates from the golden path: tests/unit/i18n-home-recent-requests-topology-legend.test.ts 5/5; neighbouring i18n suites (i18n-vi-completeness, i18n-placeholder-parity, i18n-ui-value-drift, i18n-pt-br, i18n-locale-surfaces-parity, translator-friendly-i18n-keys, i18n-hardcoded-ui-regressions, i18n-translation-ratio-gate, i18n-config) 250/250; npm run i18n:check-ui-coverage PASS (41 locales ≥ 80%); BASE_REF=origin/release/v3.8.51 npm run i18n:check-value-drift PASS; npm run i18n:check-ratio OK (41 locales within baseline +0.5); npm run check:changelog-integrity OK; node scripts/check/check-complexity-ratchets.mjs --base-ref origin/release/v3.8.51 OK (0 violations)
  • npm run lint — not run repository-wide; eslint and prettier were run on the two touched TS files and the catalogs, both clean
  • Reconciled with the current active release base release/v3.8.51; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR
  • SonarQube is temporarily opt-in while the private project has no quota; it is not a PR gate.

Red on the base: the new test file fails 4 of 5 cases against release/v3.8.51 (keys missing, English copies present, legend borrowing settings.recent); green with this change (5/5).

Tests Added Or Updated

  • tests/unit/i18n-home-recent-requests-topology-legend.test.ts (new, 5 cases): the eight home-widget keys exist and are non-empty in all 42 catalogs; es/pt/pt-BR/fr/de/it/vi hold real translations (no __MISSING__ marker, not the English value, with es.home.topologyLegendError = "Error" allow-listed as a genuine cognate); no locale keeps a silent English copy of the five recent-requests keys (translated or marked); HomeProviderTopologySection.tsx reads the legend from home.topologyLegend* and no longer from settings.recent / analytics.modelStatusError; the three legend labels share capitalisation within each maintained locale.

Coverage Notes

  • src/app/(dashboard)/dashboard/HomeProviderTopologySection.tsx: the only production change is three t() calls and the removal of three unused useTranslations hooks; the new static test pins the key names it must use. No touched file lost coverage.
  • src/i18n/messages/*.json: catalog data, covered by the new test and the existing i18n gates listed above.

Reviewer Notes

  • The __MISSING__: markers replace values that were already English, so nothing regresses visually in those locales: deepMergeFallback (src/i18n/request.ts) renders the English fallback exactly as before. The change makes the debt visible to the translation pipeline instead of hiding it as "covered".
  • nl.home.recentRequestsModel becomes __MISSING__:Model although Dutch "Model" is correct; I left it to the pipeline rather than hand-pick cognates outside the languages I can vouch for. The same applies to any other coincidental cognate among the marked locales.
  • German legend "Zuletzt" (most recently routed) was chosen over "Kürzlich" because the amber dot marks the last provider that served a request, not a time window.
  • Manual check on a Spanish UI: home page with showProviderTopologyOnHome enabled, then confirm the panel header, the three column headers, the empty state and the legend all read in Spanish, and that the legend casing matches the "Activo · Reciente · Error" row.

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