fix(i18n): close the lint-invisible gaps the guard structurally cannot see (#2470)

Co-authored-by: Kandev Agent <agent@kandev.dev>
This commit is contained in:
João Salavisa
2026-08-10 00:21:39 +02:00
committed by GitHub
parent 84ce139b35
commit fb63a88cd1
134 changed files with 2161 additions and 404 deletions
+31 -1
View File
@@ -165,7 +165,37 @@ prefix-only pattern silently never matches — write the full match.
The same hazard, milder, applies to any display string that doubles as a
comparison key or `Map` key (command-palette group names, header titles). Key off
a stable id and translate only at render.
a stable id and translate only at render. `kanban-header.tsx` shipped
`title === "Home"` for a while — true only in English, and silently the wrong
branch everywhere else.
### …and to any display string that is also PERSISTED
A string that is both shown to the user and written to storage cannot simply be
wrapped in `t()`: translating it in place writes whichever locale happened to be
active into the user's saved record, where it stays after a switch. Three places
in the app are like this, and all three use the same split — a canonical English
value for storage beside a catalog key for display:
| Module | Persisted | Displayed |
| --- | --- | --- |
| `lib/state/layout-manager/constants.ts` | `PANEL_REGISTRY[id].title` | `titleKey` via `panelTitle()` |
| `lib/layout/layout-profiles.ts` | `BUILT_IN_LAYOUT_PROFILES[i].name` | `nameKey` via `builtInLayoutProfileName()` |
| `lib/state/slices/ui/sidebar-view-builtins.ts` | `DEFAULT_VIEW.name` | `sidebarViewName()` |
Get the **direction** right, and write a test that pins it. Dockview panel
titles pass through the serializer twice: `toSerializedDockview` feeds
`api.fromJSON` and so must localize, while `panelFromDockviewPanel` is what
`fromDockviewApi` captures into a saved layout and so must canonicalize. The
first version of that split had them reversed; every unit test passed, because
the test had been written to the same wrong model. What caught it was the
pseudo-locale oracle — which could only see it because the layouts screen's
`allow` list had stopped claiming those titles were expected-English.
The other seeded-preset modules (`my-github/search-bar.ts`, `my-jira/presets.ts`,
`azure-devops-workspace-defaults.ts`) are deliberately English for the same
reason and have **not** been split, because their values are also sent to an
agent or matched against a server-side default. Each says so in a header comment.
## Commands