-1
Hello, I am in a project of a translation of a system that is actually a directory structure and I decided to use Google translator to do this, using the following block of code
<script>
var comboGoogleTradutor = null; //Varialvel global
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'pt',
includedLanguages: 'en,es,pt',
layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
}, 'google_translate_element');
comboGoogleTradutor = document.getElementById("google_translate_element").querySelector(".goog-te-combo");
}
function changeEvent(el) {
if (el.fireEvent) {
el.fireEvent('onchange');
} else {
var evObj = document.createEvent("HTMLEvents");
evObj.initEvent("change", false, true);
el.dispatchEvent(evObj);
}
}
function trocarIdioma(sigla) {
if (comboGoogleTradutor) {
comboGoogleTradutor.value = sigla;
changeEvent(comboGoogleTradutor);//Dispara a troca
}
}
</script>
But when I authenticate in the system, the dynamic fields (List and derivatives) do not translate automatically, only if I call the translation again on a button
I’ve tried $Document.ready for the code to run again when the screen is loaded and with an if, if the English option was selected on the last page, but I can’t. Someone can give me a light?