MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / localize

Function localize

examples/js/common.js:74–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72 }
73
74 function localize() {
75 var lang = utils.getLanguage();
76 var pathname = window.location.pathname.replace("/en/", "/");
77 var hash = window.location.hash;
78 var href = window.location.origin + pathname;
79 if (lang === "en-US") {
80 if (getVersion()) {
81 href = window.location.origin + pathname.replace(/([^\/]*\/){1}([^\/]*)/, '$1$2/en');
82 //href = window.location.origin + pathname.replace(/([^\/]*\/){2}([^\/]*)/, '/$1$2/en');
83 } else if (window.isLocal) {
84 href = window.location.origin + pathname.replace(/(([^\/]*\/){3})([^\/]*)/, '$1$3/en')
85 } else {
86 href = window.location.origin + pathname.replace(/([^\/]*\/){1}([^\/]*)/, '/en/$2');
87 //href = window.location.origin + pathname.replace(/([^\/]*\/){1}([^\/]*)/, '/$2/en');
88 }
89
90 }
91 if ((window.location.origin + window.location.pathname + hash) === href + hash) {
92 return;
93 }
94 window.location = href + hash;
95 }
96
97 function getCommonScriptPath() {
98 var r = new RegExp("(^|(.*?\\/))(common\.js)(\\?|$)"),

Callers 1

common.jsFile · 0.70

Calls 1

getVersionFunction · 0.85

Tested by

no test coverage detected