moses toh
moses toh

Reputation: 13162

How can I set default translate i18n in nuxt js?

I had set default it in nuxt.config.js like this :

enter image description here

But if I access localhost it redirect to : http://localhost:3000/en Should it redirect to http://localhost:3000/

How can I solve this problem?

Upvotes: 1

Views: 3832

Answers (1)

hosein azimi
hosein azimi

Reputation: 321

You should use detectBrowserLanguage Like this :

For example default locale set to FR

[
  'nuxt-i18n',
  {
    locales: ['fr', 'en'],
    defaultLocale: 'fr',
    detectBrowserLanguage: false,
    vueI18n: {
      fallbackLocale: 'en',
      messages: {
        fr: {
          index:'home'
        },
        en: {
          index:'Index'
        }
      }
    }
  }
],

Upvotes: 5

Related Questions