/*
 * @Author: vera_min vera_min@163.com
 * @Date: 2025-08-02 12:21:54
 * @LastEditors: vera_min vera_min@163.com
 * @LastEditTime: 2025-08-06 01:54:53
 * @FilePath: /sagoo-admin-ui/src/i18n/index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createI18n } from 'vue-i18n';
import zhcnLocale from 'element-plus/lib/locale/lang/zh-cn';
import enLocale from 'element-plus/lib/locale/lang/en';
import zhtwLocale from 'element-plus/lib/locale/lang/zh-tw';
import { store } from '/@/store/index';

import nextZhcn from '/@/i18n/lang/zh-cn';
import nextEn from '/@/i18n/lang/en';
import nextZhtw from '/@/i18n/lang/zh-tw';

import pagesLoginZhcn from '/@/i18n/pages/login/zh-cn';
import pagesLoginEn from '/@/i18n/pages/login/en';
import pagesLoginZhtw from '/@/i18n/pages/login/zh-tw';
import pagesFormI18nZhcn from '/@/i18n/pages/formI18n/zh-cn';
import pagesFormI18nEn from '/@/i18n/pages/formI18n/en';
import pagesFormI18nZhtw from '/@/i18n/pages/formI18n/zh-tw';
import pagesTable18nZhcn from './pages/tableI18n/zh-cn';
import pagesTable18nEn from './pages/tableI18n/en';
import pagesTable18nZhtw from './pages/tableI18n/zh-tw';

import pagesIotmanagerZhcn from './pages/iotmanagerI18n/zh-cn';
import pagesIotmanagerEn from './pages/iotmanagerI18n/en';
import pagesIotmanagerZhtw from './pages/iotmanagerI18n/zh-tw';

import pagesIotcardZhcn from './pages/iotCard/zh-cn';
import pagesIotcardEn from './pages/iotCard/en';
import pagesIotcardZhtw from './pages/iotCard/zh-tw';

// 定义语言国际化内容
/**
 * 说明：
 * /src/i18n/lang 下的 ts 为框架的国际化内容
 * /src/i18n/pages 下的 ts 为各界面的国际化内容
 */
const messages = {
	[zhcnLocale.name]: {
		...zhcnLocale,
		message: {
			...nextZhcn,
			...pagesLoginZhcn,
			...pagesFormI18nZhcn,
			...pagesTable18nZhcn,
			...pagesIotmanagerZhcn,
			iotCard: pagesIotcardZhcn
		}
	},
	[enLocale.name]: {
		...enLocale,
		message: {
			...nextEn,
			...pagesLoginEn,
			...pagesFormI18nEn,
			...pagesTable18nEn,
			...pagesIotmanagerEn,
			iotCard: pagesIotcardEn
		},	
	},
	[zhtwLocale.name]: {
		...zhtwLocale,
		message: {
			...nextZhtw,
			...pagesLoginZhtw,
			...pagesFormI18nZhtw,
			...pagesTable18nZhtw,
			...pagesIotmanagerZhtw,
			iotCard: pagesIotcardZhtw
		},
	},
};

// 导出语言国际化
export const i18n = createI18n({
	locale: store.state.themeConfig.themeConfig.globalI18n,
	fallbackLocale: zhcnLocale.name,
	messages,
	silentTranslationWarn: true,
	missingWarn: false,
	silentFallbackWarn: true,
	fallbackWarn: false
});
