Skip to content

chore(i18n): remove 175 dead desktop frontend i18n keys (deadcode r71) - #4332

Open
topcheer wants to merge 1 commit into
mainfrom
chore/deadcode-r71
Open

topcheer wants to merge 1 commit into
mainfrom
chore/deadcode-r71

Conversation

@topcheer

Copy link
Copy Markdown
Owner

Round 71 full-repo dead code scan — focus domain: desktop wails frontend i18n (frontend/src/i18n, 13 locale .ts const maps, en.ts = TranslationKey baseline).

Method (frontend-specific channel)

  • Consumption mechanism first: React context t(key) via useTranslation(); 13 dynamic sites (t(cmd.nameKey) etc.) verified to be fed by literal-only field assignments (80 assignments audited, 6 non-literal = type declarations).
  • Key set extracted from en.ts (751) vs widest consumption set: all dot-form string literals in src (covers direct t(), ternary branches, xxxKey fields, arrays) → 175 candidates.

Four defenses (all green)

  1. Zero references outside i18n defs in frontend/src (ts/tsx incl. *.test.ts)
  2. Zero template-concat key construction (prefix${x})
  3. Zero string-concat key construction (pfx. + x)
  4. Zero references repo-wide (Go/html/json; i18n dir, node_modules excluded)
    Control: known-live key settings.title correctly found consumed (r70 co-evidence).

Removed clusters = legacy superseded keys

  • chat.slash* (20) → superseded by cmd.* (23 live in CommandPalette/Layout)
  • mcp.type* → superseded by mcp.transport*/desc* (TRANSPORTS)
  • im.adapterName* batch → superseded by im.title batch (IMManagement)
  • plus onboarding/settings/sidebar/approval/pairing/window/etc. legacy keys

All 13 locale files kept in sync (zh.ts & co. use Record<TranslationKey, string>); post-delete residual grep = 0 (also proves no missed deletions). No Go embed linkage: wails embeds built frontend/dist (gitignored build artifact), .ts sources are compile-time only; wails is a separate Go module untouched.

Verification

  • npm run typecheck (tsc --noEmit): 0 errors
  • vitest: 13 files / 135 tests passed
  • go build -tags goolm ./...: exit 0 (pre-commit hook re-ran vet+build)
  • Pure line deletions: 13 files, −2275 lines, +0

Baseline: origin/main d631d90; in-flight i18n PRs #4317/#4321/#4325/#4327/#4328/#4329/#4330/#4331 all still OPEN (no rebase needed).

Round 71 full-repo dead code scan, focus: desktop wails frontend i18n
domain (desktop/ggcode-desktop-wails/frontend/src/i18n).

Method: extracted en.ts key set (751 keys) as TranslationKey baseline,
built widest-possible consumption set from ALL dot-form string literals
in src (covers t('k'), ternary branches, xxxKey field literals), then
subtracted. 175 keys had zero references; verified via 4 defenses:
1. zero hits outside i18n defs in frontend/src (all ts/tsx incl. tests)
2. zero template-concat constructions (`prefix${x}` form)
3. zero string-concat constructions ('pfx.' + x form)
4. zero hits repo-wide (Go/html/json, i18n dir and node_modules excluded)

Removed clusters are legacy keys replaced by newer ones, e.g.
chat.slash* (20) superseded by cmd.* (23 in CommandPalette/Layout),
mcp.type* by mcp.transport*/desc*, im.adapterName* batch by im.title
batch, onboarding.mode*/step* legacy set.

Removed the same 175 keys from all 13 locale files (zh.ts and others
use Record<TranslationKey, string> so they must stay in sync; residual
grep = 0 proves no missed deletions).

Verification: npm run typecheck (tsc --noEmit, 0 errors), vitest 13
files / 135 tests all pass, go build -tags goolm ./... exit 0.

Co-Authored-By: ggcode <noreply@ggcode.dev>

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