【问题标题】:Invalid configuration: Current language is not included in all languages array i18next无效配置:当前语言未包含在所有语言数组 i18next 中
【发布时间】:2020-10-25 07:09:47
【问题描述】:

我正在使用 NextJS 和 i18next

这是我的配置文件

const NextI18Next = require('next-i18next').default;

module.exports = new NextI18Next({
  localePath: 'public/static/locales',
  browserLanguageDetection: false,
  serverLanguageDetection: false,
  defaultLanguage: 'en',
  otherLanguages: ['en','ru'],
  load: 'all',
});

它可以工作(语言是变化的)但它返回给我这个错误

Invalid configuration: Current language is not included in all languages array

我尝试了很多东西,但都没有奏效

【问题讨论】:

    标签: reactjs internationalization next.js i18next next-i18next


    【解决方案1】:

    您的 defaultLanguage 是“en”,这意味着它不应该在您的 otherLanguages 数组中。从 otherLanguages 中删除 'en',它应该可以工作。

    【讨论】:

      猜你喜欢
      • 2013-10-07
      • 2020-09-26
      • 1970-01-01
      • 1970-01-01
      • 2020-11-24
      • 2020-09-26
      • 2014-05-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多