Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

I18n vs next-i18next

next-i18next

The next-i18next config file

...

We will then set the fallback language. This is so if we can not provide the preferred language for a user, we can specify another language as fallback. By default, the fallbackLng is set to the defaultLocale. In this case, we do not need to actually set the fallbackLng. Setting the fallbackLng can also increase the page size.

Code Block
module.exports = {
  i18n: {
    // all the locales supported in the application
    locales: ['en-GB', 'en-US'], 
    // the default locale to be used when visiting
    // a non-localized route (e.g. `/about`)   
    defaultLocale: 'en-GB',
  },

  fallbackLng: 'en-GB',
}

...