Skip to content

[Fix] PWA i18n structural integrity — complete key coverage, stable debug log keys, CI guard#199

Merged
samzong merged 1 commit intomainfrom
fix/debug-log-i18n
Mar 27, 2026
Merged

[Fix] PWA i18n structural integrity — complete key coverage, stable debug log keys, CI guard#199
samzong merged 1 commit intomainfrom
fix/debug-log-i18n

Conversation

@samzong
Copy link
Copy Markdown
Collaborator

@samzong samzong commented Mar 27, 2026

Summary

Fix i18n structural integrity across the PWA package: en.json becomes the authoritative superset, all defaultValue anti-patterns are eliminated, GatewayDebugLog gains full i18n support with stable React keys, and the CI check script is extended to guard both desktop and PWA.

Type of change

  • [Fix] bug fix
  • [Build] CI, packaging, or tooling change

Why is this needed?

GatewayDebugLog was the only PWA component with hardcoded English strings while every other component uses useTranslation(). Deeper investigation revealed systemic i18n issues: en.json (the fallback locale) was missing 8 keys that existed in other locales, 12 t() calls used defaultValue as a crutch (scattering English text between locale files and component code), DebugLogEntry lacked stable IDs causing React key misuse (key={i}), 10 dead locale keys existed from desktop copy-paste, and the CI check script only covered the desktop package.

What changed?

  • en.json authoritative superset: Added 8 missing keys (app.name, shell.reconnect, settings.*, drawer.title/search, tools.emptyDetails)
  • Key parity across all 8 locales: Added app.name, drawer.title, drawer.search, tools.emptyDetails to all non-English locales
  • Eliminated all defaultValue usage: Removed 12 occurrences across 7 component files + error-classify.ts (kept dynamic-key fallback in formatErrorForToast)
  • Stable debug log IDs: Added monotonic id field to DebugLogEntry in debug.ts; GatewayDebugLog uses key={entry.id} instead of key={i}
  • debugLog i18n namespace: 6 new keys across all 8 locales; GatewayDebugLog now uses useTranslation() for all user-visible strings
  • Dead key cleanup: Removed 10 unused PWA locale keys (chat.you, gateway.notFound, pairing.{error,retryButton,scanning,title}, shell.{bootstrapping,connected}, tools.{expandButton,collapseButton})
  • CI guard extended: check-i18n.mjs now covers both desktop and PWA packages, and detects defaultValue anti-pattern on static keys

Architecture impact

  • Owning layer: renderer (PWA), core (error-classify), build (scripts)
  • Cross-layer impact: yes — DebugLogEntry interface in packages/pwa/src/lib/debug.ts gains an id: number field; error-classify.ts in core removes redundant defaultValue on static keys
  • Invariants touched from docs/architecture-invariants.md: none
  • Why those invariants remain protected: changes are additive (new interface field, new locale keys) or subtractive (removed dead keys and anti-patterns); no message persistence or gateway protocol changes

Linked issues

Closes the GatewayDebugLog i18n gap identified during PWA development.

Validation

  • pnpm lint
  • pnpm test
  • pnpm typecheck
  • pnpm check:i18n
  • pnpm build
  • Manual smoke test
  • Not run

Commands, screenshots, or notes:

pnpm typecheck — passed
pnpm test — 157/157 tests passed (shared: 6, pwa: 59, desktop: 92)
node scripts/check-i18n.mjs — all checks passed (key parity, unused keys, defaultValue, quick-launch drift)

Screenshots or recordings

No UI layout changes. All modifications are string substitutions (hardcoded → i18n) and locale file updates.

Release note

  • No user-facing change. Release note is NONE.
  • User-facing change. Release note is included below.
Gateway debug log panel now supports all 8 languages. Fixed missing translations for settings, navigation drawer, and shell reconnect across all locales.

Checklist

  • The PR title uses at least one approved prefix: [Feat], [Fix], [UI], [Docs], [Refactor], [Build], or [Chore]
  • The summary explains both what changed and why
  • Validation reflects the commands actually run for this PR
  • Architecture impact is described and references any touched invariants
  • Cross-layer changes are explicitly justified
  • The release note block is accurate

@github-actions
Copy link
Copy Markdown
Contributor

Hi @samzong,
Thanks for your pull request!
If the PR is ready, use the /auto-cc command to assign Reviewer to Review.
We will review it shortly.

Details

Instructions for interacting with me using comments are available here.
If you have questions or suggestions related to my behavior, please file an issue against the gh-ci-bot repository.

@samzong samzong force-pushed the fix/debug-log-i18n branch from 889ca3f to f8845c0 Compare March 27, 2026 01:32
@samzong samzong merged commit bc4850e into main Mar 27, 2026
7 checks passed
@samzong samzong deleted the fix/debug-log-i18n branch March 29, 2026 14:10
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