Skip to content

i18n: Replaced hard-coded "no {modelName} found" message in DataTable #51209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const AssetEvents = ({
displayMode="card"
initialState={tableUrlState}
isLoading={isLoading}
modelName="Asset Event"
modelName={translate("common:assetEvent_one")}
noRowsMessage={translate("noAssetEvents")}
onStateChange={setTableUrlState}
skeletonCount={5}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
type Updater,
} from "@tanstack/react-table";
import React, { type ReactNode, useCallback, useRef, useState } from "react";
import { useTranslation } from "react-i18next";

import { CardList } from "src/components/DataTable/CardList";
import { TableList } from "src/components/DataTable/TableList";
Expand Down Expand Up @@ -75,6 +76,7 @@ export const DataTable = <TData,>({
skeletonCount = 10,
total = 0,
}: DataTableProps<TData>) => {
const { t: translate } = useTranslation(["common"]);
const ref = useRef<{ tableRef: TanStackTable<TData> | undefined }>({
tableRef: undefined,
});
Expand Down Expand Up @@ -144,7 +146,7 @@ export const DataTable = <TData,>({
) : undefined}
{!hasRows && !Boolean(isLoading) && (
<Text pl={4} pt={1}>
{noRowsMessage ?? `No ${modelName}s found.`}
{noRowsMessage ?? translate("noItemsFound", { modelName })}
</Text>
)}
{hasPagination ? (
Expand Down
33 changes: 32 additions & 1 deletion airflow-core/src/airflow/ui/src/i18n/locales/zh-TW/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,37 @@
"restApiReference": "REST API 參考"
},
"logout": "登出",
"logoutConfirmation": "確定要登出嗎?",
"modal": {
"cancel": "取消",
"confirm": "確認"
},
"nav": {
"admin": "管理者",
"assets": "資源",
"browse": "瀏覽",
"dags": "Dags",
"docs": "文件",
"home": "首頁",
"plugins": "插件"
"plugins": "插件",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong. Missed this one. Let me send a new PR for it 🤔

"security": "安全"
},
"noItemsFound": "找不到{{modelName}}",
"pools": {
"deferred": "已延後",
"open": "開啟",
"pools_one": "資源池",
"pools_other": "資源池",
"queued": "排隊中",
"running": "執行中",
"scheduled": "已排程"
},
"security": {
"actions": "操作",
"permissions": "權限",
"resources": "資源",
"roles": "角色",
"users": "使用者"
},
"selectLanguage": "選擇語言",
"states": {
Expand Down Expand Up @@ -59,5 +83,12 @@
"pastWeek": "過去一週"
},
"timezone": "時區",
"timezoneModal": {
"current-timezone": "目前時區",
"placeholder": "搜尋時區",
"title": "選擇時區",
"utc": "UTC"
},
"triggered": "已觸發",
"user": "使用者"
}