This is my config file:
i18n.js:
import i18n from 'i18next';
import Backend from 'i18next-xhr-backend';
import detector from "i18next-browser-languagedetector";
import { initReactI18next } from 'react-i18next';
const fallbc = ['en'];
const langArr = ['en', 'de'];
i18n
.use(detector)
.use(Backend)
.use(initReactI18next)
.init({
backend: {
loadPath: '/register/locales/{{lng}}/{{ns}}.json'
},
fallck,
debug: true,
whitelist: langArr,
interpolation: {
escapeValue: false,
},
react: {
wait: true,
},
});
export default i18n;
And when I try this:
import i18n from '../i18n';
return (
<div>
<button onClick={() => i18n.changeLanguage('de')}>de</button>
<button onClick={() => i18n.changeLanguage('en')}>en</button>
</div>
);
Only English is rendered, the German is not. What am I doing wrong?
Is something wrong with my configuration? I feel that I am really close to resolving this.