nuxt3
nuxt3 copied to clipboard
Path setting not mapped
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?