Posted By

gfazioli on 07/11/08


Tagged

ajax javascript google prototypejs api translate language markup


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

gfazioli
carlosabargues
umang_nine


Google AJAX API Language e Prototype.js


 / Published in: JavaScript
 

URL: http://www.undolog.com/2008/05/13/google-ajax-api-language-e-prototypejs/

  1. /*
  2. ** @name : translate()
  3. ** @description : translate
  4. */
  5. function translate() {
  6. $$('[rel="translate"]').each(
  7. function(e) {
  8. google.language.translate(e.innerHTML, 'it', 'en',
  9. function(result) {
  10. if (result.translation) {
  11. e.innerHTML = result.translation;
  12. } else {
  13. alert( 'Translate Error!\n\n' + result.error.message );
  14. }
  15. }
  16. );
  17. }
  18. );
  19. }

Report this snippet  

You need to login to post a comment.