Pastetool - google_language_translate

URL: , Paste another

<html>
  <head>
    <script type="text/javascript" src="http://www.google.com/jsapi">
    </script>
    <script type="text/javascript">

    google.load("language", "1");

    function initialize() {
      var text = document.getElementById("text").innerHTML;
      google.language.detect(text, function(result) {
        if (!result.error && result.language) {
          google.language.translate(text, result.language, "en",
                                    function(result) {
            var translated = document.getElementById("translation");
            if (result.translation) {
              translated.innerHTML = result.translation;
            }
          });
        }
      });
    }
    google.setOnLoadCallback(initialize);

    </script>
  </head>
  <body>
	The "Hello, World" of the Google AJAX Language API
    <div id="text">&#20320;&#22909;&#65292;&#24456;&#39640;&#33288;&#35211;&#21040;&#20320;&#12290;</div>
    <div id="translation"></div>
  </body>
</html>

Download code


This code was pasted on March 1, 2010




Protected with advance Anti-SPAM techniques :)
Coded and designed by Fedmich
Follow us on Twitter