importing i18n stays null and never provides a client #1779
-
I think I might have some misunderstanding on how to add a resource bundle on client side. I am following this section import { i18n } from 'next-i18next'
...
useEffect(() => {
if (!assetType || !translationFile || !locale) return
i18n?.addResourceBundle(locale, assetType?.id, translationFile)
})
...
const { t, ready } = useTranslation(assetType?.id) and for some reason the i18n is always null and I never receive a client. My understanding is that I have the withTranslation HOC wrapped on my What am I missing to make the client initialize? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
As answered in many other places, the global |
Beta Was this translation helpful? Give feedback.
-
@isaachinman So I read some other discussion and one of your answers said that i18n should auto initialize after mount. So I created a quick repo to try and reproduce it. I am sure I have something that I am not doing correctly and I am not sure what. If you could help me and take a look at it that would be appreciated https://github.com/bu3alwa/next-i18next-test. I do get |
Beta Was this translation helpful? Give feedback.
As answered in many other places, the global
i18n
object gets initialised whenappWithTranslation
is run.