1Weglot.initialize({ 2 api_key: 'wg_d8085e47473606b0d9f209052b45e26b1', 3 4 // Cache Weglot's translations; translations are kept up-to-date asynchronously. 5 cache: true, 6 7 // Customizing floating default switcher. 8 button_style : { 9 full_name: true, 10 with_name: true, 11 is_dropdown: false, // All languages visible; custom dropdown outside of Weglot. 12 with_flags: false // Don't display any flags. 13 }, 14 15 // For multiple switchers. 16 switchers: [ 17 { 18 // Using same as button_style at root. 19 button_style: { 20 full_name: true, 21 with_name: true, 22 is_dropdown: false, 23 with_flags: false 24 }, 25 // Move switcher somewhere else on the page. 26 location: { 27 target: ".translate__container", 28 sibling: null 29 } 30 } 31 ] 32}); 33 34// When switchers are ready 35Weglot.on("switchersReady", function () { 36 const activeLanguage = document.querySelector('.wgcurrent.wg-li a'); 37 if (activeLanguage) { 38 const icon = document.createElement('i'); 39 icon.className = "fas fa-check"; 40 icon.setAttribute('role', 'presentation'); 41 activeLanguage.insertAdjacentHTML('beforeend', ' '); 42 activeLanguage.appendChild(icon); 43 } 44}); 45 46// When the language changes 47Weglot.on("languageChanged", function () { 48 // Remove existing icon 49 const activeLanguageCheck = document.querySelector('.wg-li a .fa-check'); 50 if (activeLanguageCheck) { 51 activeLanguageCheck.parentElement.removeChild(activeLanguageCheck); 52 } 53 54 // Add new icon 55 const activeLanguage = document.querySelector('.wgcurrent.wg-li a'); 56 if (activeLanguage) { 57 const icon = document.createElement('i'); 58 icon.className = "fas fa-check"; 59 icon.setAttribute('role', 'presentation'); 60 activeLanguage.insertAdjacentHTML('beforeend', ' '); 61 activeLanguage.appendChild(icon); 62 } 63 64 // Hide widget 65 const widget = document.getElementsByClassName('translate__wrapper'); 66 for (let i = 0; i < widget.length; i++) { 67 widget[i].classList.remove('active'); 68 } 69});
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.