import { createI18n } from 'vue-i18n';

// 导入静态翻译内容
import en from './en.json';
import zhHans from './zh-Hans.json';
import zhHant from './zh-Hant.json';
import ja from './ja.json';
// 导入动态翻译函数
import messagesFunctions from './messagesFunctions.js';

// 合并静态和动态的翻译内容
const mergedMessages = {
  en: {
    ...en,
    ...messagesFunctions.en,
  },
  'zh-Hans': {
    ...zhHans,
    ...messagesFunctions.zhHans,
  },
  'zh-Hant': {
    ...zhHant,
    ...messagesFunctions.zhHant,
  },
  ja: {
    ...ja,
    ...messagesFunctions.ja,
  },
};

const language = "zh-Hans";
const i18n = createI18n({
  locale: language,
  messages: mergedMessages
});
uni.setStorageSync("eliteSys-language-wx", language);

export default i18n;