Repository navigation
fix(Table): translate sort header screen-reader labels - #4073
Conversation
buildAriaLabel still hardcoded English ('Sort by X, sorted ascending,
priority 1 of 2') after the i18n sweep migrated the sort menu labels —
the plain-helper return value evades the no-hardcoded-i18n-string lint
rule. Route all three aria-label forms through useTranslator() with
full-sentence ICU messages (no segment concatenation; direction words
resolve via their own keys, following the Chat status precedent).
English output is byte-identical.
Closes the last concrete gap of meta#3618; part of tracker meta#3636.
Claude-Session: https://claude.ai/code/session_01P9qSoGWZPPp9pUNNRUSwkM
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis ReportNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | View full report |
- Override both direction keys in the multi-sort test with words that differ from the raw enum values, proving descending (and the priority branch) resolve through @astryx.table.sort.direction.* rather than interpolating the enum. - Also override @astryx.table.sort.sortedBy in the single-sort test, proving the composed template routes through the catalog (a hardcoded English frame previously went undetected). - Move t() into each ternary branch so the direction-key literals are visible to the @astryx/i18n-key-format lint rule. Both gaps mutation-verified: each doctored implementation fails exactly its new test; the untouched suite stays 40/40.
humbertovirtudes
left a comment
There was a problem hiding this comment.
Approving. Clean closure of the last gap in #3618.
The three header-button label forms now route through useTranslator() with the new catalog keys, and resolving the direction word through its own direction.* entry rather than interpolating the raw enum is the correct call. English output is byte-identical, which the untouched existing tests confirm.
The new tests are mutation-resistant, not tautological: the French overrides (croissant/decroissant) deliberately differ from the raw enum values, so a hardcoded English frame or raw-enum interpolation fails the suite for both directions.
One thing worth a note, not blocking: interpolating a separately-translated word into a sentence carries the usual fragment-composition risk (gender and declension can shift the surrounding words in some languages). You flagged the ICU select alternative and chose the separate-key approach to match the existing Chat status precedent, deferring the standardization to #3636. That is a reasonable, precedent-backed tradeoff.
Thanks for the careful work here. CI is green.
What this does
Makes the Table sort headers' screen-reader labels ("Sort by Name, sorted ascending, priority 1 of 2") translatable, like the rest of the component strings.
Why
The i18n system and catalog are live, and the sort context-menu labels were already migrated — but the header button labels come from a plain helper whose return value slips past the hardcoded-string lint rule, so they stayed English in every locale. This closes the last concrete gap raised in #3618, under tracker #3636.
What changed
selectinside the sentence was considered instead; the separate word key won for consistency with Chat's existingstatuspattern — one for the [Tracker] i18n & RTL support — string injection + RTL correctness #3636 standardization discussion.How to see it
pnpm exec vitest run packages/core/src/Table/plugins/sortable/useTableSortable.test.tsx— 40/40 pass. Lint passes with no suppressions.Fixes #3618