Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
Why does i18next work with some languages ​and not with others?

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!