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 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"deferred": "Deferred",
"no_status": "No Status"
},
"noItemsFound": "No {{modelName}}s found.",
"dagRun_one": "Dag Run",
"dagRun_other": "Dag Runs",
"taskInstance_one": "Task Instance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"deferred": "已延後",
"no_status": "無狀態"
},
"noItemsFound": "找不到{{modelName}}",
"dagRun_one": "Dag 執行",
"dagRun_other": "Dag 執行",
"taskInstance_one": "任務實例",
Expand Down