Repository navigation
Commit ad74e98
fix(plugin-list): translate the synthetic "All records" user-filter tab (objectui#13405) (#13423)
Closes #13405
Clause-②: no
## What changed
A tabs-mode user-filter bar with `showAllRecords` appends a synthetic
trailing tab, `{ id: '__all__', … }`, whose label was the literal
English string `'All records'`, so a zh-CN list showed it beside
translated tabs.
- `packages/plugin-list/src/UserFilters.tsx` (`TabFilters`): the label
is now read through `useSafeTranslate()` (the hook `DropdownFilters` in
the same file already uses) as `tt('list.userFilters.allRecords', 'All
records')`. The translated value is read into a string before the
`allTabs` memo, so the memo keys on that string and not on the
per-render identity of `tt` (AGENTS.md #10). `TabFilters` is a
component, so the hook path needed no workaround.
- One new key, **`list.userFilters.allRecords`**, in all ten packs under
`packages/i18n/src/locales/`: en `All records`, zh `全部记录`, ja
`すべてのレコード`, ko `전체 레코드`, de `Alle Datensätze`, es `Todos los registros`,
fr `Tous les enregistrements`, pt `Todos os registros`, ru `Все записи`,
ar `جميع السجلات`. No other key is touched.
- The `__all__` id and the tab's behaviour (no conditions, reported as
`_tab: __all__`) are unchanged.
- `.changeset/user-filters-all-records-label-13405.md`: patch for
`@object-ui/plugin-list` and `@object-ui/i18n`.
**Why a new key rather than the existing `list.allRecords`:** that key's
en value is Title Case (`All Records`). Reusing it would change the
English tab label, and the card asks for en to keep reading `All
records`. Its translations match the new key's values in every non-en
pack.
## Tests
New file
`packages/plugin-list/src/__tests__/UserFilters.allRecordsLabel-13405.test.tsx`:
- zh: the `filter-tab-__all__` tab reads `全部记录`, and no `All records`
text is drawn.
- en: the tab reads `All records`. With no provider, the inline fallback
also reads `All records`.
- CONTROL: the authored tabs keep their authored labels in zh and en.
- CONTROL: clicking the tab still emits `[]` and `{ _tab: ['__all__']
}`.
- The controls wait for the catalogue through a separate probe
(`t('common.more')`), not through the tab label, so they do not depend
on the fix.
Results at head `2fbb3b2033`:
- `pnpm exec vitest run --maxWorkers=2 packages/plugin-list/
packages/i18n/` (under the verify lock): `Test Files 243 passed (243)`,
`Tests 2945 passed | 13 skipped (2958)`, VERDICT command-exit 0.
- `all-locales-key-parity` + `en-zh-key-parity` run explicitly: `Test
Files 2 passed (2)`, `Tests 48 passed (48)`.
- `pnpm check:i18n-keys`, `check:i18n-drift` (reports "0 en value(s)
changed (1 key(s) added, 0 removed)"), `check:i18n-dead-keys` (the new
key is not listed), and `check:i18n-designer-parity`: all exit 0.
- `turbo run type-check --filter=@object-ui/plugin-list
--filter=@object-ui/i18n`: `Tasks: 15 successful, 15 total`, 0 `error
TS`. Both packages ran `tsc --noEmit && tsc -p tsconfig.test.json`.
Dependents were not type-checked.
- eslint on the touched files: 0 errors. The 30 warnings are existing
`no-explicit-any` warnings, none on the changed lines.
- `node scripts/check-changeset-presence.mjs`: ✅, 1 changeset declared.
`pnpm check:new-line-citations`: 0 new citations.
**Ablation.** The fix was committed first. Then the label was set back
to the literal `'All records'` (on-disk check: injected=1,
`allRecordsLabel` uses left=0) and the new file was run. Result: `Tests
1 failed | 4 passed (5)`. Only the zh pin went red; the en, no-provider
and both control cases stayed green, as expected. The file was restored
with `git checkout HEAD --`: `git diff HEAD` is empty and the blob hash
matches HEAD.
## Acceptance notes
- Noted, not filed: the same tab strip's `allowAddTab` affordances are
also English literals (`title="Remove tab"`, the `Remove tab …`
aria-label, `title="Add filter tab"`, `placeholder="Tab name"` and the
`Add tab` button text in `TabFilters`). They are outside this card's
surface and their reach was not measured. Carrier: none.
- [x] Adds no product-specific widget, dialog, hook or string (see
AGENTS.md › Product-neutral renderer)
Session: `https://claude.ai/code/session_01WJozybDmRH8z2c5SD7vJkj`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WJozybDmRH8z2c5SD7vJkj
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 130c77d commit ad74e98
13 files changed
Lines changed: 175 additions & 2 deletions
File tree
- .changeset
- packages
- i18n/src/locales
- plugin-list/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
867 | 867 | | |
868 | 868 | | |
869 | 869 | | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
870 | 873 | | |
871 | 874 | | |
872 | 875 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
770 | 770 | | |
771 | 771 | | |
772 | 772 | | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
773 | 776 | | |
774 | 777 | | |
775 | 778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
972 | 972 | | |
973 | 973 | | |
974 | 974 | | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
975 | 979 | | |
976 | 980 | | |
977 | 981 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
800 | 803 | | |
801 | 804 | | |
802 | 805 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
795 | 798 | | |
796 | 799 | | |
797 | 800 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
770 | 770 | | |
771 | 771 | | |
772 | 772 | | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
773 | 776 | | |
774 | 777 | | |
775 | 778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
770 | 770 | | |
771 | 771 | | |
772 | 772 | | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
773 | 776 | | |
774 | 777 | | |
775 | 778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
795 | 798 | | |
796 | 799 | | |
797 | 800 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
820 | 820 | | |
821 | 821 | | |
822 | 822 | | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
823 | 826 | | |
824 | 827 | | |
825 | 828 | | |
| |||
0 commit comments