👏

vue-i18nとNuxt3

2022/05/24に公開

DO NOT USE intlify/nuxt3 FOR NOW

Cauz so many bugs...

install vue-18n-next

yarn add vue-i18n@9

make a plugin for nuxt3

Make a folder with path like /plugins/i18n.client.ts.

Then edit it like this:

import { createI18n } from 'vue-i18n'

const messages = {
  en: {
    message: {
      hello: 'hello world'
    }
  },
  ja: {
    message: {
      hello: 'こんにちは、世界'
    }
  }
}

const i18n = createI18n({
  locale: 'ja',
  fallbackLocale: 'en', 
  messages,
})

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(i18n)
})
  • ALL DONE! *

Discussion