This commit is contained in:
蔡玲
2024-12-03 16:40:54 +08:00
parent 6e6dd6a4fc
commit 9d776c65e9
408 changed files with 498647 additions and 99 deletions

View File

@@ -0,0 +1,47 @@
Object.defineProperty(window.top.frames[0].LANGUAGE_Index,'name', { //.frames[0]
get: function () {
return name;
},
set: function (newValue) {
name = newValue;
sessionStorage.setItem("LANGUAGE_Index",newValue);
loadText()
}
});
function loadText(){
// console.log("window.top.LANGUAGE_Index.name="+window.top.LANGUAGE_Index.name)
// console.log("i18nType11="+i18nType)
// if(i18nType != 'undefined'){
// i18nType = window.top.LANGUAGE_Index.name
// console.log("i18nType22="+window.top.LANGUAGE_Index.name)
// }
let languageMap;
try{
languageMap = new Map(Object.entries(JSON.parse(sessionStorage.getItem("LanguageMap"))));
}catch (ex){return ;}
//console.log("languageMap",languageMap)
try {
//初始化页面元素
$('[data-i18n-placeholder]').each(function () {
$(this).attr('placeholder', languageMap.get($(this).data('i18n-placeholder')));
});
$('[data-i18n-text]').each(function () {
//如果text里面还有html需要过滤掉
var html = $(this).html();
//console.log("111",html)
var reg = /<(.*)>/;
if (reg.test(html)) {
var htmlValue = reg.exec(html)[0];
$(this).html(htmlValue + languageMap.get($(this).data('i18n-text')));
}
else {
$(this).text(languageMap.get($(this).data('i18n-text')));
}
});
$('[data-i18n-value]').each(function () {
$(this).val(languageMap.get($(this).data('i18n-value')));
});
}
catch(ex){ }
}