From de40902be3610580c0571d1989d09775434cef5c Mon Sep 17 00:00:00 2001 From: xHomu <84349818+xHomu@users.noreply.github.com> Date: Thu, 7 Mar 2024 10:52:45 -0800 Subject: [PATCH] useChangeLanguage bug was fixed #124 (#180) Fixed in #124 --- README.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/README.md b/README.md index 79c7a60..be21dba 100644 --- a/README.md +++ b/README.md @@ -288,17 +288,6 @@ export default function Root() { } ``` -> **Warning** In latest versions you may find an error with `useChangeLanguage` hook, (see [#107](https://github.com/sergiodxa/remix-i18next/issues/107)), to solve it, you can deep import it from the package with `import { useChangeLanguage } from 'node_modules/remix-i18next/browser/react';`, or copy the code of `useChangeLanguage` to your own app and use it instead of the one provided by `remix-i18next`. - -```ts -export function useChangeLanguage(locale: string) { - let { i18n } = useTranslation(); - useEffect(() => { - i18n.changeLanguage(locale); - }, [locale, i18n]); -} -``` - Finally, in any route you want to translate, you can use the `t()` function, as per the [i18next documentation](https://www.i18next.com/overview/api#t) and use translations from the default namespace. ```tsx