Vue i18n multilingual internationalization

import Vue from "vue"
import App from". / App"
import router from". / router/index"
import base from". / src/css/base.css"
import FastClick from "fastclick"
import axios from" axios"
import VueI18n from "vue-i18n"
import store from". / store/store"

import zh from". / components/lang/zh"
import en from". / components/lang/en"

/ / Vue.config.productionTip = false;

Vue.prototype.$axios=axios;
Vue.use (VueI18n);

const i18n = new VueI18n ({
locale: "zh-CN", / / language ID
/ / this.$i18n.locale / / achieve language switching by switching the value of locale
messages: {

"zh-CN": zh,   // 
"en-US": en    // 

}
});

/ eslint-disable no-new /
new Vue ({
el:"- sharpapp",
router,
store,
i18n,
components: {App},
template:"< App/ >"
}). $mount ("- sharpapp");
Vue.i18n ((key, value) = > i18n.t (key, value));

clipboard.png

Mar.19,2021

clipboard.png
later wrote this sentence to solve the problem.

Menu