Topic Text   Topic Comments (0)   Topic Properties   Topic Information lol@gma...
Topic title: gesto es narauder Friday July 8, 2011 08:16:54

Download topic text | View in variable-width font | Tab width set to 4 (change to 8)

Files in topic: (view all files)  
codigo.txt   {+26,-0}

[Add General Comment] to topic.

File codigo.txt (Revision 1.0) [Add File Comment] [Top]
 
1 /*
2 * How to translate text.
3 */
4
5 google.load("language", "1");
6
7 function initialize() {
8 var content = document.getElementById('content');
9 // Setting the text in the div.
10 content.innerHTML = '<div id="text">Hola, me alegro mucho de verte.<\/div><div id="translation"/>';
11
12 // Grabbing the text to translate
13 var text = document.getElementById("text").innerHTML;
14
15 // Translate from Spanish to English, and have the callback of the request
16 // put the resulting translation in the "translation" div.
17 // Note: by putting in an empty string for the source language ('es') then the translation
18 // will auto-detect the source language.
19 google.language.translate(text, 'es', 'en', function(result) {
20 var translated = document.getElementById("translation");
21 if (result.translation) {
22 translated.innerHTML = result.translation;
23 }
24 });
25 }
26 google.setOnLoadCallback(initialize);
 
File codigo.txt (Revision 1.0) [Add File Comment] [Top]
  
Legend:
Removed 
Changed
 Added

[Add General Comment] to topic.