Skip to content

Latest commit

 

History

History
34 lines (29 loc) · 848 Bytes

11.locale-fallback.md

File metadata and controls

34 lines (29 loc) · 848 Bytes
title description
Locale fallback
How a fallback gets selected when a translation is missing

@nuxtjs/i18n takes advantage of Vue I18n ability to handle localization fallback. It is possible to define a single fallback locale, an array of locales, or a decision map for more specific needs.

export default defineNuxtConfig({
  // ...
  
  i18n: {
    vueI18n: {
      fallbackLocale: 'en',
      // or
      fallbackLocale: ['en', 'fr'],
      // or
      fallbackLocale: {
        'de-CH':   ['fr', 'it'],
        'zh-Hant': ['zh-Hans'],
        'es-CL':   ['es-AR'],
        'es':      ['en-GB'],
        'pt':      ['es-AR'],
        'default': ['en', 'da']
      }
    }
  },

  // ...
})

More information in Vue I18n documentation