functioninitialize() { var text = document.getElementById("text").value; var tlang = document.getElementById("tlang").value google.language.detect(text, function(result) { if (!result.error &&result.language) { google.language.translate(text, result.language, tlang, function(result) { var translated = document.getElementById("translation"); if (result.translation) { translated.value = result.translation; } }); } }); } </script>
</head>
<body> <body> Auto detect source language and translateto:<br/> <select id="tlang"> <option value="zh-TW">ChineseTrad</option> <option value="zh-CN">ChineseSimpl</option> <optionvalue="en">English</option> <optionvalue="fi">Finnish</option> <optionvalue="fr">French</option> <optionvalue="de">German</option> <optionvalue="it">Italian</option> <optionvalue="ja">Japanese</option> <optionvalue="ko">Korean</option> <optionvalue="pt">Portuguese</option> <optionvalue="es">Spanish</option> </select><br/> <textarea id="text" name="query"height="100px">Enter stringhere</textarea><BUTTON TYPE=BUTTONonClick="initialize()"> <I>GO</I></BUTTON><br/> <textarea id="translation" name="results"height="100px">Results</textarea><br/> Copy from the above text box and paste the textwhere ever. If there is an update, it will be here:<ahref="http://www.waiseto.com/2009/01/simple-google-translator-widget-for-s60.html">link</a>Enjoy W. Seto
@Override public voidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// Set the layout for this activity. You can findit // in res/layout/hello_activity.xml setContentView(R.layout.hello_activity); WebView wv; wv = (WebView) findViewById(R.id.text); wv.getSettings().setJavaScriptEnabled(true); wv.loadUrl("file:///data/index.html");