Hi, I am struggling to get i18next working properly, and it's probably a mistake by myself, but I can't figure it out.
I have followed the README.md , but for some reason, the client-side hydration seems not to be working properly.
The markup sent by the server is translating everything correctly, but as soon as the hydration starts, the correct translation is converted into the translation key.
When debugging, I saw that i18n.getResource('de', 'common', 'greeting') returns undefined, so I assume that the issue comes from loading the translation files.
This is how my entry.client.ts looks like:
import { RemixBrowser } from '@remix-run/react';
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from 'i18next-fs-backend';
import { hydrate } from 'react-dom';
import { I18nextProvider, initReactI18next } from 'react-i18next';
import { getInitialNamespaces } from 'remix-i18next';
import i18nConfig from './i18n/i18nConfig';
i18next
.use(initReactI18next)
.use(LanguageDetector)
.use(Backend)
.init({
...i18nConfig,
ns: getInitialNamespaces(),
backend: {
loadPath: '/translations/{{lng}}/{{ns}}.json',
},
detection: {
order: ['htmlTag'],
caches: [],
},
})
.then(() =>
hydrate(
<I18nextProvider i18n={i18next}>
<RemixBrowser />
</I18nextProvider>,
document,
),
);
Does anybody have an idea, of what my config/setup issue is? Happy to share some code when you tell me, which files to check/code to share.
Thanks!