Skip to content

Commit

Permalink
fix: added translation interpolation and plurality
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGhadyani-Okta committed Jun 13, 2023
1 parent 5e3e216 commit 39ee64d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
18 changes: 15 additions & 3 deletions packages/odyssey-react-mui/src/InfinitelyScrolledDataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
useRef,
useState,
} from "react";
import { useTranslation } from "react-i18next";
import { Trans, useTranslation } from "react-i18next";

export type DefaultMaterialReactTableData = Record<string, unknown>;

Expand Down Expand Up @@ -130,11 +130,23 @@ const InfinitelyScrolledDataGrid = <
() =>
fetchMoreData ? (
<Typography>
{t("datagrid.fetchedrows.text", String(totalFetchedRows))}
<Trans
count={totalFetchedRows}
i18nKey="datagrid.fetchedrows.text"
values={{
totalRows: totalFetchedRows,
}}
/>
</Typography>
) : (
<Typography>
{t("datagrid.rows.text", String(totalFetchedRows))}
<Trans
count={totalFetchedRows}
i18nKey="datagrid.rows.text"
values={{
totalRows: totalFetchedRows,
}}
/>
</Typography>
),
[fetchMoreData, totalFetchedRows]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
datagrid.error = Error loading data.
datagrid.fetchedrows.text = Fetched {0} total rows
datagrid.rows.text = {0} rows
datagrid.fetchedrows.text = Fetched {{totalRows}} row
datagrid.fetchedrows.text_plural = Fetched {{totalRows}} total rows
datagrid.rows.text = {{totalRows}} row
datagrid.rows.text_plural = {{totalRows}} rows
fielderror.screenreader.text = Error
fieldlabel.optional.text = Optional
fieldlabel.required.text = Required
Expand Down

0 comments on commit 39ee64d

Please sign in to comment.