npm i vue3-i18n-plugin --save
import App from "./App.vue";
import { createApp } from "vue";
import i18n from "vue3-i18n-plugin";
createApp(App)
.use(i18n, {
initial: "zh",
translationConfiguration: {
zh: {
hello: "你好",
},
en: {
hello: "hello",
},
},
})
.mount("#app");
<div>{{ $t('hello') }}</div>
import { changeLocal } from "vue3-i18n-plugin";
changeLocal("zh");