Skip to content

Commit

Permalink
useChangeLanguage bug was fixed #124 (#180)
Browse files Browse the repository at this point in the history
Fixed in #124
  • Loading branch information
xHomu authored Mar 7, 2024
1 parent a6c4647 commit de40902
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de40902

Please sign in to comment.