import { Locale } from 'vant';
import { lang } from "@/settings/designSetting";
import { useLangStore } from "@/stores/modules/langStore";



const langStore = useLangStore();

// UI组件语言包
import enUS from 'vant/es/locale/lang/en-US';
import zhHK from 'vant/es/locale/lang/zh-HK';

const i18nUi = new Map([
  ["zh-HK", zhHK],
  ["en-US", enUS]
]); 


// 切换端语言包
export const useLang = (e) => {
  const setLang = e || langStore?.lang || lang 
  Locale.use(setLang, i18nUi.get(setLang));
}