I'm using i18next and when i call the changeLanguage function with the languages 'es' or 'en' it seems to work perfectly, but when i call it when another language 'de' 'fr' 'it' or whatever, it doesn't works and it goes to the fallbackLng. It's kind of weird because with two languages works perfect, but the other three languages doesn't works
This is my i18n.ts file
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
const frenchTranslatorObject = require('../assets/locales/fr.json');
const spanishTranslatorObject = require('../assets/locales/es.json');
const englishTranslationObject = require('../assets/locales/en.json');
const germanTranslationObject = require('../assets/locales/gr.json');
const portugeseTranslationObject = require('../assets/locales/pt.json');
const italianishTranslationObject = require('../assets/locales/it.json');
export default i18n.use(initReactI18next).init({
resources: {
es: {
translation: {
'landing.main.title': 'en SPANISH',
},
},
en: {
translation: {
'landing.main.title': 'EN ENGLISH',
},
},
fr: {
translations: {
'landing.main.title': 'en FRANCES',
},
},
de: {
translations: {
'landing.main.title': 'EN ALEMANNNN',
},
},
it: {
translations: {
'landing.main.title': 'EN ITALIANO',
},
},
pt: {
translations: {
'landing.main.title': 'EN PORTUGUES',
},
},
},
lng: 'es',
fallbackLng: ['en', 'es', 'fr'],
compatibilityJSON: 'v3',
interpolation: {
escapeValue: false,
format: function (value, format, lng) {
if (value && format === 'uppercase') {
return value.toUpperCase();
} else if (value && format === 'lowercase') {
return value.toLowerCase();
} else if (value && format === 'capitalize') {
return value.charAt(0).toUpperCase() + value.slice(1);
}
return value;
},
},
});
i18n.on('languageChanged', (lng) => {
console.info('callback log that triggers when language change', lng);
});
and I call the function like this: i18n.changeLanguage('de');
If anyone sees any errors that can tell me, I will be grateful