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

159
Visualizações
i18Next: use locale only for some languages and use language + location for rest

I have a question for the i18next library. If I have these set of locales that are possible to be detected from the browser,

de
en-US
es
fr
it
ja
ko
pt-br
zh-cn
zh-tw

Is there a way to configure it where it respects the language only for some locales and not the other? for example, when it comes to en-US, I wish for the loaded language to be en so when I call the .language or .languages method, it will contain en instead of en-US. However, for the other locales that have a dash like pt-br, zh-cn, and zh-tw, they will remain untouched, (so NOT return just zh).

Is this possible?

thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Yes, make use of the configuration options: https://www.i18next.com/overview/configuration-options

With the load option set to "all", it will first check for "en-US" and if not found, it will use "en"... and the i18next.resolvedLanguage value will be "en"

There are also other configuration options, like supportedLngs, or fallbackLng you could use to tune your use case.

about 4 years ago · Juan Pablo Isaza Relatório
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