useTranslation from documentation does not exist
I'm trying to use the
useTranslation
hook just like in the documentation. I've followed all the steps, and inside the Header component I'm trying to do import { useTranslation } from '@refinedev/core';
, and then :
But it says that useTranslation
does not exist, and the suggested useTranslate
does not provide any of the aforementioned properties.3 Replies
Hi @Raekh. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It seems like there might be some confusion between the
useTranslation
hook from @refinedev/core
and the one from react-i18next
. Based on the provided documentation, here is how you can correctly use the useTranslation
hook from @refinedev/core
.
First, ensure that you have set up the i18nProvider
correctly in your App.tsx
file. Here is an example setup:
Source (https://refine.dev/docs/guides-concepts/i18n/#creating-the-i18n-provider)
Next, in your Header
component, you should be able to use the useTranslation
hook from @refinedev/core
as follows:
Source (https://refine.dev/docs/guides-concepts/i18n/#changing-the-locale)
Make sure you have the correct imports and that your i18nProvider
is properly set up and passed to the <Refine />
component. This should resolve the issue of useTranslation
not being recognized. If you still encounter issues, double-check that all dependencies are correctly installed and up to date.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@111054132537741312> kapa.ai is still learning and improving, please let us know how it did by reacting below
metropolitan-bronzeOP•8mo ago
Everything should be correct as per the documentation but it doesn't work. This answer doesn't provide anything more than the documentation does.