Iview + vue-i18n Modal and DatePick components cannot be translated

problem description

the project uses iview and vue-i18n plug-in, and basically all of them can be translated. However, it is found that Modal and DatePick of iview cannot be translated and no error is reported.

the environmental background of the problems and what methods you have tried

at present, there are two solutions on the Internet:

  1. Vue.prototype._i18n = i18n; ( https://www.jianshu.com/p/e22.)

clipboard.png
https://codeshelper.com/a/11.

but none of this works for me

related codes

-dividing line-

locale/index
import Vue from "vue";
import VueI18n from "vue-i18n";

import customZhCn from "./lang/zh-CN";
import customEnUs from "./lang/en-US";
import zhCnLocale from "webbase/dist/locale/zh-CN";
import enUsLocale from "webbase/dist/locale/en-US";
// import zhCnLocale from "webbase/src/locale/lang/zh-CN";
// import enUsLocale from "webbase/src/locale/lang/en-US";

Vue.use(VueI18n);

const locales = {
  "zh-CN": Object.assign(customZhCn, zhCnLocale),
  "en-US": Object.assign(customEnUs, enUsLocale)
};
// 
const DEFAULT_LANG = "zh-CN";
// localStorage
const STORAGE_LANG = "locale";

// 
const navLang = navigator.language;
const localLang = locales[navLang] ? navLang : false;
let lang = localStorage.getItem(STORAGE_LANG) || localLang || DEFAULT_LANG;

// vue-i18n 6.x+
Vue.locale = () => {
};

const messages = locales;


const i18n = new VueI18n({
  locale: lang,
  messages
});

export default i18n;

-dividing line-

main.js

Vue.use(webBase, {i18n: (key, value) => i18n.t(key, value)});
new Vue({
  el: "-sharpapp",
  i18n,
  router,
  store,
  render: (h) => h(App)
}

where webBase is equivalent to iview, with its own defined component, and its function is the same

what result do you expect? What is the error message actually seen?

if you have encountered this problem, let"s take a look at

.
Feb.28,2022

I think the iview document translated by the

modal box has found a solution. The footer confirmation and cancellation is done by this okText:this.$t ('mem.ok'), cancelText:this.$t (' mem.cancel'), which is connected to this

.
this.$Modal.confirm({
    title: this.$t('mem.confirm'),
    content:this.$t('mem.content'),
    okText:this.$t('mem.ok'),
    cancelText:this.$t('mem.cancel'),
    onOk: this.confirmRemove
    })

however, with regard to the paging one, I haven't thought of a good way yet

Menu