/*
 * @FilePath: \wwwd:\code\screenFront\src\locales\index.ts
 * @Author: 王路平
 * @文件版本: V1.0.0
 * @Date: 2023-05-04 16:36:13
 * @Description: 
 * 
 * 版权信息         : 2023 by ${再登软件}, All Rights Reserved.
 */

import { createI18n } from 'vue-i18n'
import enLocale from './lang/en';
import zhLocale from './lang/zh';
import { getStoredLanguage, saveStoredLanguage } from "../utils/languageStorage";
 
const messages = {
    简体中文: zhLocale,
    'English/USD': enLocale,
}
 
const defaultLocale = "简体中文";
const storedLocale = getStoredLanguage() || defaultLocale;
 
const i18n = createI18n({
    globalInjection: true, //全局生效$t
    fallbackLocale: '简体中文',
    locale: storedLocale,
    legacy: false, // 解决legacy mode 报错
    messages
})
 
export default i18n;