import Vue from 'vue';
import VueI18n from 'vue-i18n';
import customZH from './locale/zh';
import customEN from './locale/en';
// 菜单翻译，前端开发使用，后面会去掉
import menuZH from './locale/zh/menuMock';
import menuEN from './locale/en/menuMock';
// 如果需要使用框架的多语言文件，则需要引入@erayt/language包
import lang from '@erayt/language';
import ecasZh from './locale/zh/ecas-lang-zh_cn';
import ecasEn from './locale/en/ecas-lang-en';
import loadMessageJsFileZH from './locale/zh/loadMessageJsFile';
import loadMessageJsFileEN from './locale/en/loadMessageJsFile';
import Vuedynamic from 'vue-dynamic';

Vue.use(VueI18n);

export const messages = {
  en_US: {
    ...ecasEn,
    ...Vuedynamic.lang.en,
    ...lang.message.en,
    ...customEN,
    ...menuEN,
    ...loadMessageJsFileEN,
  },
  zh_CN: {
    ...ecasZh,
    ...Vuedynamic.lang.zh,
    ...lang.message.zh,
    ...customZH,
    ...menuZH,
    ...loadMessageJsFileZH,
  },
};
// 引入框架的错误码后，需要调用mergeToolTip进行合并数据，此数据会加入到Eui.Messager.messages中
// lang.mergeToolTip({
//   en_US: toolTipEn,
//   zh_CN: toolTipZh
// })

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

export default i18n;
