I am trying to convert the whole web page in different language based on the user who is logged in. I am using the following code
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
includedLanguages: 'es',
layout: google.translate.TranslateElement.InlineLayout.SIMPLE,
autoDisplay: true,
}, 'google_translate_element');
}
</script>
<script type="text/javascript"
src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
This is working as expected but user has to choose the language. Is there a way I can automate this?
Also as the translate is deprecated does any body has a guide or tutorial to use the new google translate API.
Any have searched too many posts but none of them auto translate option or using the new API's