/ Published in: JavaScript
Expand |
Embed | Plain Text
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Google AJAX Language API - Basic Translation</title> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> //Docs //http://code.google.com/apis/ajaxlanguage/documentation/#Examples //Language codes //http://code.google.com/apis/ajaxlanguage/documentation/reference.html#LangNameArray google.load("language", "1"); function initialize() { google.language.translate("Hello world", "en", "es", function(result) { if (!result.error) { var container = document.getElementById("translation"); container.innerHTML = result.translation; } }); } google.setOnLoadCallback(initialize); </script> </head> <body> <div id="translation"></div> </body> </html>
You need to login to post a comment.
