Locales

The I18n module powers the localization.

If you want to see how to organize translated blog posts check the Writing blog posts guide.

You can update your blog's languages by accessing the nuxt.config.js file and updating the values of the i18n.locales and i18n.vueI18n.messages properties.

Each language must have a file in the 18n directory and a folder named with its code in the content directory.

export default theme({
  ...
  i18n: {
    locales: [
      {
        code: 'fr',
        iso: 'fr-FR',
        name: 'Fran├žais',
      },
      {
        code: 'en',
        iso: 'en-US',
        name: 'English',
      },
    ],
    defaultLocale: 'en',
    vueI18n: {
      fallbackLocale: 'en',
      messages: {
        en: require('./i18n/en-US'),
        fr: require('./i18n/fr-FR'),
      },
    },
  },
  ...
})

When more than one locale is defined, a language switcher appears in the footer of the blog.

Edit this page on GitHub Updated at Mon, Mar 15, 2021