I have a Website which currently is only in English. However, we have a Google Translate widget which will translate the website to any language selected by the user. Here's the small snippet:
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement(
{ pageLanguage: 'en',
layout: google.translate.TranslateElement.InlineLayout.SIMPLE
}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Now, I will be routing some traffic from Spanish speaking users to the site. Considering I know these are spanish speaking users, is there any call I can make on the code to Automatically translate the website to Spanish (i.e to simulate a user selecting a given option on the Translate)? I'd be using a specific URL param, such as for example lang=spa.
I tried browsing the code that gets inserted when the DIV is loaded, but it was just a very messy code to even look at.
Has anyone tried such thing, can you provide a code bit to follow up from?
Thanks.