intlify / nuxt3

Nuxt 3 Module for vue-i18n-next

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Path setting not mapped

todaynogada opened this issue · comments

export default {
// ...
buildModules: ['@intlify/nuxt3'],
// config for @intlify/nuxt3
intlify: {
vueI18n: 'vue-i18n.mjs'
}
}

vue-i18n.mjs

// The configuration must be returned with an async function.
export default async () => ({
locale: 'en',
messages: {
en: {
hello: 'hellotest'
},
ja: {
hello: 'こんにちは、{name}!'
}
}
})

index.vue

import { useI18n } from 'vue-i18n'

{{ t("hello") }}

const { t, te } = useI18n();

Returns hello as a string.

Also, how can I change to another language if I already use en?

For example, I want to convert by selecting a language in the select box.

Do you have a guide on this?