From 0dbb975501b673e6ef59bf934eba344c879d4de7 Mon Sep 17 00:00:00 2001 From: amir ali Date: Thu, 16 May 2024 13:25:07 +0500 Subject: [PATCH 1/2] chore: remove deprecation mark from localize --- src/utils/localize.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/utils/localize.ts b/src/utils/localize.ts index 7a123d2..f1de42f 100644 --- a/src/utils/localize.ts +++ b/src/utils/localize.ts @@ -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} values * @returns {string} From 0250e9afd3741c535a8baa43301987ebab7b5374 Mon Sep 17 00:00:00 2001 From: amir ali Date: Thu, 16 May 2024 13:25:28 +0500 Subject: [PATCH 2/2] fix: rerender issue on localize component --- src/components/localize.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/localize.tsx b/src/components/localize.tsx index c74a518..0b88ed5 100644 --- a/src/components/localize.tsx +++ b/src/components/localize.tsx @@ -1,4 +1,5 @@ -import { Trans } from "react-i18next"; +import type { i18n } from "i18next"; +import { Trans, withTranslation } from "react-i18next"; type TLocalizeProps = { i18n_default_text: string; @@ -6,9 +7,11 @@ type TLocalizeProps = { components?: JSX.Element[]; options?: Record; shouldUnescape?: boolean; + i18n?: i18n; }; -export default function Localize({ +function Localize({ + i18n, i18n_default_text, values, components, @@ -18,6 +21,7 @@ export default function Localize({ return ( ); } + +export default withTranslation()(Localize);