Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Revision as of 06:00, 10 October 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Google Translate API in WRT

From Wiki
Jump to: navigation, search

Simple Symbian Web Runtime app that uses Google Translate API to detect the source language and translate to target language. You can download the WRT widget itself, rename the extension from .wgz to .zip. Unzip file file and you will have the source code.

Article Metadata
Code Example
Installation file: GoogleTranslator0.1.wgz
Created: wmseto (09 Apr 2009)
Last edited: hamishwillee (10 Oct 2012)

Source file


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="">
<title>Google Translator</title>
<meta name="generator" content="BBEdit 8.6" />
<script src="main.js"></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
google.load("language", "1");
function initialize() {
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;
Auto detect source language and translate to:<br/>
<select id="tlang">
<option value="zh-TW">Chinese Trad</option>
<option value="zh-CN">Chinese Simpl</option>
<option value="en">English</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="pt">Portuguese</option>
<option value="es">Spanish</option>
<textarea id="text" name="query" height="100px">Enter string here</textarea> <BUTTON TYPE=BUTTON onClick="initialize()">
<textarea id="translation" name="results" height="100px">Results</textarea><br/>
Copy from the above text box and paste the text where ever. If there is an update, it will be here: <a href="">link</a> Enjoy W. Seto


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Nokia//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Google translator</string>
This page was last modified on 10 October 2012, at 06:00.
41 page views in the last 30 days.