Skip to content

fix(plugin-list): translate ListView empty-state title and message - #1610

Closed
baozhoutao wants to merge 1 commit into
mainfrom
fix/listview-empty-state-i18n
Closed

fix(plugin-list): translate ListView empty-state title and message#1610
baozhoutao wants to merge 1 commit into
mainfrom
fix/listview-empty-state-i18n

Conversation

@baozhoutao

Copy link
Copy Markdown
Contributor

Problem

The empty-state heading and body in ListView rendered in English even when the active locale (e.g. zh-CN) had translations:

No items found
There are no records to display. Try adjusting your filters or adding new data.

Root cause

Every other label in ListView goes through the i18n t() helper, but the empty-state title/message hardcoded their English fallback:

{schema.emptyState?.title??'No items found'}// ❌{schema.emptyState?.message??'There are no records to display. Try adjusting your...'}// ❌

The translation keys list.noItems / list.noItemsMessage already exist in every shipped locale (packages/i18n/src/locales/{en,zh,ja,ko,de,es,fr,pt,ru,ar}.ts) — they just weren't being used here.

Fix

Route the fallbacks through t():

{schema.emptyState?.title??t('list.noItems')}{schema.emptyState?.message??t('list.noItemsMessage')}

A user-supplied schema.emptyState.title/message still takes precedence; only the default text now localizes. No new strings needed.

Testing

  • pnpm vitest run src/__tests__/ListView.test.tsx117 passed. The existing empty-state assertion (getByText('No items found')) still passes because, without an I18nProvider, t() falls back to the English default — behavior is unchanged in the default locale.

A changeset (@object-ui/plugin-list: patch) is included.

The empty-state heading and body hardcoded their English fallback instead
of going through the i18n t() helper like every other label in ListView,
so the empty state always rendered in English even when the active locale
had translations (zh.ts already defines list.noItems / list.noItemsMessage).
Route the fallbacks through t('list.noItems') / t('list.noItemsMessage').
A user-supplied schema.emptyState.title/message still takes precedence.
@vercel

vercelBot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredJun 9, 2026 8:41am

Request Review

@baozhoutao

Copy link
Copy Markdown
ContributorAuthor

Closing as superseded. After rebasing on main I found that #1555 ("smart empty states") already fixed this — the ListView empty state now renders entirely through t() (no hardcoded English), and goes further by distinguishing first-run (list.firstRunTitle/firstRunMessage) from filtered-empty (list.noMatches/noMatchesMessage), with full en/zh translations and the shared DataEmptyState component. This PR's narrower fix (t('list.noItems')) would be a regression, so there's nothing left to merge.

@baozhoutao
baozhoutao deleted the fix/listview-empty-state-i18n branch June 9, 2026 08:58
Sign up for freeto 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

@baozhoutao