Skip to content

Commit

Permalink
Merge pull request #37 from amir-deriv/main
Browse files Browse the repository at this point in the history
Amir/Fix re render issue on resource load
  • Loading branch information
ali-hosseini-deriv authored May 16, 2024
2 parents bc8f2da + 0250e9a commit 6b4500f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/components/localize.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { Trans } from "react-i18next";
import type { i18n } from "i18next";
import { Trans, withTranslation } from "react-i18next";

type TLocalizeProps = {
i18n_default_text: string;
values?: object;
components?: JSX.Element[];
options?: Record<string, unknown>;
shouldUnescape?: boolean;
i18n?: i18n;
};

export default function Localize({
function Localize({
i18n,
i18n_default_text,
values,
components,
Expand All @@ -18,10 +21,13 @@ export default function Localize({
return (
<Trans
defaults={i18n_default_text}
i18n={i18n}
values={values}
components={components}
tOptions={options}
shouldUnescape={shouldUnescape}
/>
);
}

export default withTranslation()(Localize);
2 changes: 0 additions & 2 deletions src/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { str as crc32 } from "crc-32";
import i18next from "i18next";

/**
* @deprecated use the `localize` function from the `useTranslations` hook
*
* @param {string} string
* @param {Record<string, unknown>} values
* @returns {string}
Expand Down

0 comments on commit 6b4500f

Please sign in to comment.