I am using the google website tranlation script. It works lovely. I want to add flags for countries and change the selected language on clicking one of the flags. I can change the selected value of the combo language list but can't fire the anonymous page event handler to reload the newly selected language. How can this be achieved? Thank you
The two code blocks below can be pasted into any html website page for testing purposes.
Working google script.
<div id="google_translate_element">
</div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
includedLanguages: 'zh-CN,nl,en,fr,de,ja,ko,es,th,cy',
autoDisplay: false,
layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
}, 'google_translate_element');
}
</script>
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
My additional code to manually select language.
<a href="Javascript:updateCombobox('fr')" id="hlfrench" onclick="" >French</a>
<script language="Javascript">
function updateCombobox(newValue) {
var lang_dropdown = document.getElementById(':0.targetLanguage').firstChild;
lang_dropdown.value = newValue;
}
</script>