Código:
<script src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("language", "1"); var salida = new Array() function change(){ var elementos = document.getElementsByName("setlng"); for (x=1;x<salida.length;x++){ y = x-1; elementos[y].innerHTML = salida[x]; } } function initialize() { var elementos = document.getElementsByName("setlng"); if(elementos.length==1){ var text = elementos[0].innerHTML; google.language.translate(text, '', 'en', function (result){ if (result.translation) { var elemento = document.getElementsByName("setlng"); elemento[0].innerHTML = result.translation; } }); }else{ for (x=0;x<elementos.length;x++){ var text = elementos[x].innerHTML; var i = 0; google.language.translate(text, '', 'en', function (result){ if (result.translation) { i++; var trans = result.translation; salida[i] = trans; } }); } setTimeout("change()",2222); } } //google.setOnLoadCallback(initialize); window.onload = initialize; </script>