| | |
| | | // 远程获取语言包并加载 |
| | | import i18n from "@/main"; |
| | | import { CommonUtils } from "./common.js" |
| | | import { |
| | | CommonUtils |
| | | } from "./common.js" |
| | | const MissingKeysMap = new Map() |
| | | |
| | | // 远程获取语言包 |
| | | export async function getLanguagePackJson(language, forceUpdate = false) { |
| | | try { |
| | | const res = await CommonUtils.doRequest2Async({ |
| | | url: '/Xt_grdAlignment_WMES/SelectMESLanguage_JSON', |
| | | data: { |
| | | language: language, |
| | | forceUpdate: forceUpdate |
| | | } |
| | | }) |
| | | let {data, Message, count} = res.data |
| | | if(count == 1) { |
| | | return data |
| | | }else { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: "[i18n]获取语言包失败: " + Message |
| | | }) |
| | | return |
| | | } |
| | | }catch(err) { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: "[i18n]获取语言包失败: " + err.message |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | export function addMissingKeyToMap(key) { |
| | | MissingKeysMap.set(key, key) |
| | | } |
| | | |
| | | // 添加缺失字段到远程数据库 |
| | | export async function syncMissingKeyToDB(){ |
| | | |
| | | // 清除缺失字段缓存 |
| | | MissingKeysMap.clear() |
| | | } |