mt-yd-ui/public/i18n.js
2023-01-31 10:48:38 +08:00

42 líneas
1.0 KiB
JavaScript

/*
* @Descripttion:
* @version:
* @Author: fzq
* @Date: 2022-11-25 09:51:46
* @LastEditors: fzq
* @LastEditTime: 2023-01-30 14:26:02
*/
/**
* Created by Jacky.Gao on 2017-10-01.
*/
import defaultI18nJsonData from './designer.json';
import en18nJsonData from './designer_en.json';
// export default function buildLocal () {
// let language = getCookie('language') || 'zh-CN';
// window.i18n = defaultI18nJsonData;
// if (language !== 'zh-CN') {
// window.i18n = en18nJsonData;
// }
// }
export default function buildLocal () {
let language = getCookie('language') || 'en';
window.i18n = defaultI18nJsonData;
if (language !== 'en') {
window.i18n = en18nJsonData;
}
}
function getCookie (name) {
var strcookie = document.cookie;//获取cookie字符串
var arrcookie = strcookie.split("; ");//分割
//遍历匹配
for (var i = 0; i < arrcookie.length; i++) {
var arr = arrcookie[i].split("=");
if (arr[0] == name){
return arr[1];
}
}
return "";
}