1const elementsAriaLabel = [ 2 { selector: 'chatButton', key: 'aria-label-initial' }, 3 { selector: 'chatBox-header-languageSelect-lang', key: 'aria-label-language' }, 4 { selector: 'chatBox-bottomBar-optionsButton-button', key: 'arial-label-menu' }, 5 { selector: 'chatBox-bottomBar-userInput', key: 'aria-label-type' }, 6 { selector: 'chatBox-bottomBar-sendMessage', key: 'aria-label-send' }, 7] 8 9function updateLanguage(language) { 10 document.querySelector( 11 ".chatBox-header-languageSelect-lang span" 12 ).textContent = language.toUpperCase(); 13 14 const activeLanguage = window.chatbot_config.locales[language]; 15 updateTitle(activeLanguage); 16 updateInput(activeLanguage); 17 updateButton(activeLanguage); 18 updateOptions(activeLanguage); 19 updateAriaLabel(activeLanguage); 20 updateRate(activeLanguage); 21 updateChat(activeLanguage); 22} 23 24function updateTitle(activeLanguage) { 25 const element = document.querySelector(".chatBox .chatBox-header-title"); 26 element.textContent = activeLanguage["title"]; 27} 28 29function updateInput(activeLanguage) { 30 const element = document.querySelector(".chatBox input.chatBox-bottomBar-userInput"); 31 element.placeholder = activeLanguage["input-placeholder"]; 32} 33 34function updateButton(activeLanguage) { 35 const element = document.querySelector(".chatBot .chatButton span"); 36 // parsea para q las etiquetas funcionen 37 element.innerHTML = activeLanguage["open-button"]; 38} 39 40function updateRate(activeLanguage) { 41 const element = document.querySelector(".chatBot .chatRate-title"); 42 // parsea para q las etiquetas funcionen 43 element.innerHTML = activeLanguage["rate-chatbot"]; 44} 45 46function updateChat(activeLanguage) { 47 const text = document.querySelector(".chatBot .chatBox-content-msg-text.first-text"); 48 const q1 = document.querySelector(".chatBot .chatBox-content-msg-question.q-1"); 49 const q2 = document.querySelector(".chatBot .chatBox-content-msg-question.q-2"); 50 const q3 = document.querySelector(".chatBot .chatBox-content-msg-question.q-3"); 51 52 text.textContent = activeLanguage["first-text"]; 53 q1.textContent = activeLanguage["q-1"]; 54 q2.textContent = activeLanguage["q-2"]; 55 q3.textContent = activeLanguage["q-3"]; 56} 57 58function updateOptions(activeLanguage) { 59 const elements = document.querySelectorAll( 60 "ul.chatBox-bottomBar-optionsButton-menu > li" 61 ); 62 elements.forEach((option) => { 63 const key = option.dataset.key; 64 option.textContent = activeLanguage[key]; 65 }); 66} 67 68function updateAriaLabel (activeLanguage) { 69 elementsAriaLabel.forEach(({selector, key}) => { 70 const element = document.querySelector(`.${selector}`); 71 element.setAttribute('aria-label', activeLanguage[key]); 72 }) 73}
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.