<!– Code provided by Google –>

function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: ‘en’, layout: google.translate.TranslateElement.InlineLayout.SIMPLE, autoDisplay: false}, ‘google_translate_element’);
}

//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit
<!– Flag click handler –>

jQuery(document).ready(function() {
var $frame = $(‘.goog-te-menu-frame:first’);
if (!$frame.size()) {
alert(“Error: Could not find Google translate frame.”);
return false;
}
var lang=’Gujarati’;
// $frame.contents().find(‘.goog-te-menu2-item span.text:contains(hi)’).get(0).click();
$frame.contents().find(‘.goog-te-menu2-item span.text:contains(‘+lang+’)’).get(0).click();

return false;
});

Advertisements