hello,
I am using google translation widget and i want when website open it should auto select spanish as default language.
i am using following code but its not working.
please check and advice.
<div id="google_translate_element"></div>
<%--//if you want to set default language add this--%>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<script type="text/javascript">
function googleTranslateElementInit() {
setCookie('googtrans', '/en/es', 1);
new google.translate.TranslateElement({ pageLanguage: 'ES', layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element');
}
function setCookie(key, value, expiry) {
var expires = new Date();
expires.setTime(expires.getTime() + (expiry * 24 * 60 * 60 * 1000));
document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
}
</script>