Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda