Skip to content

Commit 72d613e

Browse files
RoyLee1224sanederchik
authored andcommitted
i18n: Replaced hard-coded "no {modelName} found" message in DataTable (apache#51209)
* fix:replace hard-coded noRowMessage in DataTable * fix:remove unnecessary count * add back noRowMessage
1 parent 62dcda1 commit 72d613e

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

airflow-core/src/airflow/ui/src/components/Assets/AssetEvents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const AssetEvents = ({
109109
displayMode="card"
110110
initialState={tableUrlState}
111111
isLoading={isLoading}
112-
modelName="Asset Event"
112+
modelName={translate("common:assetEvent_one")}
113113
noRowsMessage={translate("noAssetEvents")}
114114
onStateChange={setTableUrlState}
115115
skeletonCount={5}

airflow-core/src/airflow/ui/src/components/DataTable/DataTable.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
type Updater,
3131
} from "@tanstack/react-table";
3232
import React, { type ReactNode, useCallback, useRef, useState } from "react";
33+
import { useTranslation } from "react-i18next";
3334

3435
import { CardList } from "src/components/DataTable/CardList";
3536
import { TableList } from "src/components/DataTable/TableList";
@@ -75,6 +76,7 @@ export const DataTable = <TData,>({
7576
skeletonCount = 10,
7677
total = 0,
7778
}: DataTableProps<TData>) => {
79+
const { t: translate } = useTranslation(["common"]);
7880
const ref = useRef<{ tableRef: TanStackTable<TData> | undefined }>({
7981
tableRef: undefined,
8082
});
@@ -144,7 +146,7 @@ export const DataTable = <TData,>({
144146
) : undefined}
145147
{!hasRows && !Boolean(isLoading) && (
146148
<Text pl={4} pt={1}>
147-
{noRowsMessage ?? `No ${modelName}s found.`}
149+
{noRowsMessage ?? translate("noItemsFound", { modelName })}
148150
</Text>
149151
)}
150152
{hasPagination ? (

airflow-core/src/airflow/ui/src/i18n/locales/zh-TW/common.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,37 @@
2323
"restApiReference": "REST API 參考"
2424
},
2525
"logout": "登出",
26+
"logoutConfirmation": "確定要登出嗎?",
27+
"modal": {
28+
"cancel": "取消",
29+
"confirm": "確認"
30+
},
2631
"nav": {
2732
"admin": "管理者",
2833
"assets": "資源",
2934
"browse": "瀏覽",
35+
"dags": "Dags",
3036
"docs": "文件",
3137
"home": "首頁",
32-
"plugins": "插件"
38+
"plugins": "插件",
39+
"security": "安全"
40+
},
41+
"noItemsFound": "找不到{{modelName}}",
42+
"pools": {
43+
"deferred": "已延後",
44+
"open": "開啟",
45+
"pools_one": "資源池",
46+
"pools_other": "資源池",
47+
"queued": "排隊中",
48+
"running": "執行中",
49+
"scheduled": "已排程"
50+
},
51+
"security": {
52+
"actions": "操作",
53+
"permissions": "權限",
54+
"resources": "資源",
55+
"roles": "角色",
56+
"users": "使用者"
3357
},
3458
"selectLanguage": "選擇語言",
3559
"states": {
@@ -59,5 +83,12 @@
5983
"pastWeek": "過去一週"
6084
},
6185
"timezone": "時區",
86+
"timezoneModal": {
87+
"current-timezone": "目前時區",
88+
"placeholder": "搜尋時區",
89+
"title": "選擇時區",
90+
"utc": "UTC"
91+
},
92+
"triggered": "已觸發",
6293
"user": "使用者"
6394
}

0 commit comments

Comments
 (0)