/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* ** @name : translate() ** @description : translate */ function translate() { $$('[rel="translate"]').each( function(e) { google.language.translate(e.innerHTML, 'it', 'en', function(result) { if (result.translation) { e.innerHTML = result.translation; } else { alert( 'Translate Error!\n\n' + result.error.message ); } } ); } ); }
URL: http://www.undolog.com/2008/05/13/google-ajax-api-language-e-prototypejs/