Google AJAX API Language e Prototype.js


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.