20080909作業日誌(ウェブページ翻訳)


googleで翻訳するツールを書きました。
粗い…
<html>
  <head>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">

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

    function initialize(aaa) {
      var text = document.getElementById('text'+aaa).innerHTML;
      google.language.detect(text, function(result) {
        if (!result.error && result.language) {
          google.language.translate(text, "", "zh-CN",
                                    function(result) {
            var translated = document.getElementById("translation"+aaa);
            if (result.translation) {
              translated.innerHTML = result.translation;
            }
          });
        }
      });
    }
	function fy(aaa){

	for(i=1001;i<1009;i++){
	setInterval("initialize('"+i+"');", 1000);    
			google.setOnLoadCallback(initialize);
			//alert(i);
		}
	}

    var iNum = 1001;
    var iMax = 1010;
    var iIntervalId = null;

    function incNum()
    {
initialize(iNum);
        iNum++;
        if(iNum > iMax)
        {
            clearInterval(iIntervalId);
        }
    }

    iIntervalId = setInterval(incNum, 500);
    </script>
  </head>
  <body>
    <div style="float:left" id="text1001">probably you have to set the jdbc/mySQL or other driver into following place </div><div  ><br/></div><div id="translation1001"></div>
    <div style="float:left" id="text1002">                                                                             </div><div  ><br/></div><div id="translation1002"></div>
    <div style="float:left" id="text1003">go to tomcat administration tools,                                           </div><div  ><br/></div><div id="translation1003"></div>
    <div style="float:left" id="text1004">click tomcat server, then click service(Catalina),                           </div><div  ><br/></div><div id="translation1004"></div>
    <div style="float:left" id="text1005">then expand your application context, there you see "data sources",          </div><div  ><br/></div><div id="translation1005"></div>
    <div style="float:left" id="text1006">on the right pane from drop down choose the create new data source           </div><div  ><br/></div><div id="translation1006"></div>
    <div style="float:left" id="text1007">enter the requested information.                                             </div><div  ><br/></div><div id="translation1007"></div>
    <div style="float:left" id="text1008">validation query may be SELECT=1;                                            </div><div  ><br/></div><div id="translation1008"></div>
    <div style="float:left" id="text1009">                                                                             </div><div  ><br/></div><div id="translation1009"></div>
    <div style="float:left" id="text1010">Try this as I am using this and my application running fine.                 </div><div  ><br/></div><div id="translation1010"></div>
  </body>
</html>