Search code examples
reactjsinternationalizationnext.jsi18nextnext-i18next

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


I'm use NextJS and i18next

Here is my config file

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',
});

In these .json files save my languages

And it works(Languages are change) but it returns to me this error

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

I tried so many things but nothing havent worked


Solution

  • Your defaultLanguage is 'en', which means it shouldn't be in your otherLanguages array. Remove 'en' from otherLanguages, and it should work.