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

172
Visualizações
i18next will not load custom namespace

I have an instance of i18next running as it should if I include the translations inside the init:


i18next.use(httpAPI).init({
    lng: language,
    resources: {
      en: {
        translation: {
          "html1": "foo! ",
          "html2":"bar",
        }
      },
      de: {
        translation: {
          "html1": "de-foo",
          "html2":"de-bar",
    
        }
      }
  }
})

However, I expect to be expanding my translations, and placing them in the init would become unwieldy. So I would like to split them into multiple files. I have read about using i18next.http-backend. So when I re-write my init to include the backend my init looks like this:

i18next.use(httpAPI).init({
    lng: language,
    backend:{ loadPath: '/locales/de-DE/translate.json'}
})

the translate.json file looks like this:

{"translation": {
  "html1": "backend-de-foo",
  "html2": "backend-de-bar",
}}

My main script where I am calling the i18next is in the parent directory along with my locale folder.

It does not appear to be reading from the backend loadpath, as I am not getting any translations from it. Am I missing something from i18next or is my translate file not structured properly?

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