var lgList = [ {name:'zh_CN', charset:'UTF-8', alias_name:'中文简体', type:'zh_CN', href:'customer_changedLanguage.action?request_locale=zh_CN'}, {name:'zh_TW', charset:'UTF-8', alias_name:'中文繁体', type:'zh_TW', href:'customer_changedLanguage.action?request_locale=zh_TW'}, {name:'en_US', charset:'UTF-8', alias_name:'English', type:'en_US', href:'customer_changedLanguage.action?request_locale=en_US'}, //{name:'ko_KR', charset:'UTF-8', alias_name:'한국어', type:'ko_KR', href:'customer_changedLanguage.action?request_locale=ko_KR'} ]; var mapList = [ {charset:'UTF-8', type:"0"}, {charset:'UTF-8', type:"1"}, {charset:'UTF-8', type:"2"}, //{charset:'UTF-8', type:"3"} ]; function getMapName(obj, type){ switch(type){ case "0": return obj.customer_page_map_select_baidu; case "1": return obj.map_google; case "2": return obj.map_googleforchina; //case "3": // return obj.map_korean; } } var $lg = new Object(); $lg.getLangIndex = function(name){ var arr = lgList; for (var i = 0; i < arr.length; i++) { if (arr[i].name == name) { return i; } } return -1; }; $lg.getLang = function(name){ var index = $lg.getLangIndex(name); if (index == -1) { index = 0; } return lgList[index]; }; /** * 动态加载js文件 * @param src * @param callback */ function loadLanguageScript(src, callback) { var otherJScipt = document.createElement("script"); otherJScipt = document.createElement("script"); otherJScipt.setAttribute("type", "text/javascript"); otherJScipt.setAttribute("src", src); document.getElementsByTagName("head")[0].appendChild(otherJScipt);//追加到head标签内 //判断服务器 if (navigator.userAgent.indexOf("IE") >= 0) { //IE下的事件 otherJScipt.onreadystatechange = function () { //IE下的判断,判断是否加载完成 if (otherJScipt && (otherJScipt.readyState == "loaded" || otherJScipt.readyState == "complete")) { otherJScipt.onreadystatechange = null; if (callback != null) { callback(); } } }; } else { otherJScipt.onload = function () { otherJScipt.onload = null; if (callback != null) { callback(); } }; } } function loadProperties(language, fun) { /* * jQuery.i18n.properties({//加载资浏览器语言对应的资源文件 name : 'messageResource', * //资源文件名称 path : 'i18n/', //资源文件路径 mode : 'map', //用Map的方式使用资源文件中的值 * language : language, callback : function() {//加载成功后设置显示内容 init_title(); * if(fun != undefined && fun != null) fun(); } }); */ $lg.realLang = $lg.getLang(language); loadLanguageScript( "js/international/lang/" + $lg.realLang.name + ".js", fun); }