feat(i18n): localize Configuration Chat and the last shared aria-labels (#2223)
Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+28
-3
@@ -349,9 +349,34 @@ completeness check: anything still rendering plain English under it was missed.
|
||||
- **Locale source of truth**: the `kandev_locale` cookie. The Go shell
|
||||
(`apps/backend/internal/webapp/shell.go`) reads it to set `<html lang>` and
|
||||
seed the boot payload, so first paint matches with no flash.
|
||||
- **Shared UI**: `@kandev/ui` primitives still carry their own hardcoded
|
||||
accessibility labels ("Close", "Toggle Sidebar"). Localizing them needs a
|
||||
strings-provider seam in the package; not done yet.
|
||||
- **Shared UI**: `@kandev/ui` primitives carry their own hardcoded accessibility
|
||||
labels ("Close", "Toggle Sidebar", "Loading", "Go to next page"). The package
|
||||
must not import the app's i18n runtime — it has to stay usable standalone — so
|
||||
these are localized at the **call site**, not in the package. Check the shape
|
||||
before inventing a seam, because the two halves differ:
|
||||
- **A label in an ATTRIBUTE needs nothing.** Every one of them sits on an
|
||||
element that spreads `{...props}` *after* it, so the overridable string prop
|
||||
the spec asks for already exists and the English literal is only its default.
|
||||
`Breadcrumb`'s `aria-label="breadcrumb"` was this shape: the fix was
|
||||
`aria-label={t("common:breadcrumb")}` at its three consumers (`page-topbar`,
|
||||
`task-top-bar-title`, `OfficeSimplePane`) plus a comment in the package
|
||||
recording the contract. A `label?: string` prop would have duplicated a prop
|
||||
React already gives you. Same shape, still un-overridden: `SidebarRail`'s
|
||||
`aria-label`/`title`, `Spinner`'s `aria-label="Loading"`, and `Pagination`'s
|
||||
three.
|
||||
- **A label that is a TEXT CHILD does need a seam**, because a consumer cannot
|
||||
reach it through `{...props}`: the `<span className="sr-only">` in
|
||||
`DialogContent`, `SidebarTrigger` and `BreadcrumbEllipsis` ("Close", "Toggle
|
||||
Sidebar", "More"), and `PaginationPrevious`/`PaginationNext`'s visible
|
||||
"Previous"/"Next". Each wants an optional label prop defaulting to today's
|
||||
text. Open — the dialog "Close" is the one a pseudo walk keeps surfacing,
|
||||
because every integration settings page renders it.
|
||||
|
||||
A third-party primitive is the same call: sonner names its toast region
|
||||
`Notifications alt+T` and accepts `containerAriaLabel`, which `AppToaster` in
|
||||
`src/app-shell.tsx` passes. That has to be its own component — `<I18nProvider>`
|
||||
is mounted *by* `AppShell`, so a `t()` call in `AppShell`'s own render sits
|
||||
outside the provider and would not re-render on a locale switch.
|
||||
- **Tests**: `vitest.setup.ts` calls `initI18nForTests()`. react-i18next falls
|
||||
back to the default instance when no provider is present, so no render wrapper
|
||||
is needed and every test's render tree is unchanged.
|
||||
|
||||
Reference in New Issue
Block a user