1export function language() { 2 this.attribute = null; 3 this.lng = null; 4 //initialization 5 this.init = function(attribute, lng){ 6 this.attribute = attribute; 7 this.lng = lng; 8 } 9 //translate 10 this.process = function(){ 11 let _self; 12 _self = this; 13 var xrhFile = new XMLHttpRequest(); 14 //load content data 15 xrhFile.open("GET", "/maps/js/language/"+this.lng+".json", false); 16 xrhFile.onreadystatechange = function () 17 { 18 if(xrhFile.readyState === 4) 19 { 20 if(xrhFile.status === 200 || xrhFile.status == 0) 21 { 22 var LngObject = JSON.parse(xrhFile.responseText); 23 console.log(LngObject["greeting"]); 24 var allDom = document.getElementsByTagName("*"); 25 for(var i =0; i < allDom.length; i++){ 26 var elem = allDom[i]; 27 var key = elem.getAttribute(_self.attribute); 28 29 if(key != null) { 30 console.log(key); 31 elem.innerHTML = LngObject[key] ; 32 } 33 } 34 35 } 36 } 37 } 38 xrhFile.send(); 39 } 40 41 //TODO: Funzione traduzione stringa rompiballe da sistemare!!!1 42 this.getStr = function(str) { 43 this.init(this.attribute, this.lng); 44 let _self; 45 _self = this; 46 var xrhFile = new XMLHttpRequest(); 47 //load content data 48 xrhFile.open("GET", "/maps/js/language/"+this.lng+".json", false); 49 xrhFile.onreadystatechange = function () 50 { 51 if(xrhFile.readyState === 4) 52 { 53 if(xrhFile.status === 200 || xrhFile.status == 0) 54 { 55 var LngObject = JSON.parse(xrhFile.responseText); 56 if(typeof LngObject[str] === 'undefined'){ 57 //load content data 58 xrhFile.open("GET", "/maps/js/language/en.json", false); 59 xrhFile.onreadystatechange = function () 60 { 61 if(xrhFile.readyState === 4) 62 { 63 if(xrhFile.status === 200 || xrhFile.status == 0) 64 { 65 LngObject = JSON.parse(xrhFile.responseText); 66 } 67 } 68 } 69 xrhFile.send(); 70 } 71 console.log(LngObject[str]); 72 return LngObject[str]; 73 } 74 } 75 } 76 xrhFile.send(); 77 } 78 79 this.version = '1.0.0'; 80 81} 82
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.