import { createI18n } from 'vue-i18n';
import { navigatorLanguage } from '@/common/js/utils';
// 引入简体中文语言包
import zhCN from 'vant/es/locale/lang/zh-CN';
let language = 'zh';
// 储存语言
const curLang = localStorage.getItem('curLang');
if (curLang === 'zh') {
    language = curLang;
    localStorage.setItem('curLang', curLang);
} else {
    language = navigatorLanguage();
    localStorage.setItem('curLang', navigatorLanguage());
}
// vant组件的中英文切换
import { Locale } from 'vant';
// 判断中英文，切换vant语言包
if (language === 'zh') {
    Locale.use('zh-CN', zhCN);
} else {
    Locale.use('zh-CN', zhCN);
}
export default createI18n({
    //多语言实例
    legacy: false,
    globalInjection: true,
    // 默认语言
    locale: localStorage.getItem('curLang'),
    // 关闭控制台警告
    silentFallbackWarn: true,
    messages: {
        'zh': require('../assets/language/zh.json'), //中文包
    }
});