Monday, January 26, 2009

(Simple) Google Translator Widget for S60 WRT

Story: This morning I wanted to send some Chinese SMS msgs from my phone, because today was the Lunar New Year. However, I couldn't find a way to give me easy translated strings... I searched a bit on the Internet; there were some S60 WRTs already, but none seemed to let me cut and paste the results... I was suprised no one (at least I couldn't find) had created a Google Translate version for S60. So I had done the the engineer's way, write it myself; here I go... I wrote the whole thing in less then 20 min. Believe me, it took more time to upload the widget to MOSH, create the preview pictures, and write this post to tell you about it.

Comments and suggestions are welcome. If there are updates, I will post the links in this post.

Some tips:

1) If you interested in reading more about Google AJAX Lanaguage API, here is the link: http://code.google.com/apis/ajaxlanguage/documentation/#Examples

2) If your favorite language(s), are not there you can change the code your self. Go into the widget index.html and change this section

<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">Finish</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="it">Italian</option>
<option value="ko">Korean</option>
<option value="pt">Portuguese</option>
<option value="es">Spanish</option>
</select><br/>

(there are other resources about S60 widget development, for example here, so I am not going into that here.)


That is really, now here is the link in MOSH to download and install the widget:

(MOSH download) Here is the first (0.1) version: GoogleTranslator0.1.wgz

Update 01: I have put the index.html on my web, you can use any browser to use this web app (S40 and others):

http://camelot.net/stage/gtranslator/


Update 02, 2009.02.01:
Symbian Freak site has reported this widget, thanks guys!
link




Update 03, 2009.02.25:

This widget has made top 10 freeware for Samsung over at AllAboutSymbian.com, thanks Steve! link



Update 04, 2009.04.06:

Since MOSH will be closing shortly, I have moved the widget file to this site. The link above is updated. Unforunately, I will not have the capability to trakc how many people have downloaded the widget... Cry My last count of user download from MOSH is... Smile






Update 05: 2009.04.18

If you are a developer and enjoy reading this, you might also be interested in my new article on Turn my S60 WRT into an iPhone app: http://blogs.forum.nokia.com/blog/forum-nokia-web-talks/2009/04/19/turn-my-s60-wrt-widget-to-an-iphone-app



Update 06: 2009.08.28
I suddenly decided to make a demo video... for no reason... kinda fun


- Wai Seto

17 comments:

Fabio said...

Compliments!

Would it be possibile to have a port to Java Me, for the people who doesn't have WRT on their phones? ;)

W. Seto said...

I will look into Java ME app. I have move the html to my web server too, so you can use that for now from your normal phone browser.

URL: http://camelot.net/stage/gtranslator/

(also updated in the post)

Fabio said...

Great! :)
If you happen to have a working jave ME, that'd be totally great ;)

Meanwhile, thanks for the html port ;)

VIP said...

Great idea/widget :)

Can you add "Copy to Clipboard" button?

Thanks in Advance

RANKAWATSURESH said...

great job " my dear

Felipe J. Zárate M. said...

Esta aplicación está realmente muy útil e interesante, la he probado en mi N95 y funciona a la perfección. Lo felicito desde Costa Rica.
De verdad muchísimas gracias!

W. Seto said...

@VIP, I will find some time to check that out. I have read about window.clipboarddata function in javascript, but not sure if S60 WRT support it. It is a good suggestion!

@Felipe, LOL I actually had to use my app to know what your comment was. :p Thanks!

W. Seto said...

Just want to report on the Clipboarddata function. S60 WRT does not seem to support this. Therefore it will be difficult to implement the copy button. If anyone has a suggestion on doing this, please let me know.

mehrdad said...

hi, thanks for your efforts writing this widget, yet nothing happens when I click on GO on my Nokia E90 !!! What should I do?

W. Seto said...

@mehrdad Interesting... would you do me a favor and enter this URL, http://camelot.net/stage/gtranslator/, in your browser? This page has the same code as the widget. You can check this url with Firefox, IE, or Safari also. See, if the browser in your E90 has the same behavior. I cannot offer you more then saying this may be a bug in the browser. Cheers!

mehrdad said...

hi again and thanks for your attention:-) i tried the link and i could translate a text once but after testing the widget again (which failed) the translator on the browser also disactivated!
So now both the widget and the link have the same problem: nothing happens after clicking on GO!!!

mehrdad said...

Update: I tried the URL in Camelot again with all my browsers in E90:
Native browser which is the most complete has no response to the GO command. The same is for my OPERA.

Fortunately the firefox brwoser does the job but for some reasons I see double identical texts in input and out put boxes!!!

W. Seto said...

@mehrdad sorry for getting back so late. I am not sure what is happening to your E90. I have tried N95, iPhone, and 5800 XpressMusic. They all work fine...

BTW, you have firefox for E90? That's news to me.

Un said...

Hi, great little widget. Can you please post more details into how the languages menu can be customized. I am not that familiar with the WRT or the widget structure but once I find the HTML to edit I can do that. Please tell us where to look for it.

Thanks again!

Un said...

Hi again,

I have managed to read up on widgets and realized they are basically a ZIP archive.

I have now modified the widget to display all google languages, not just a subset.

Thank you !

Un said...

I have made my own version based on your original idea and google's demo code.

I named it GoogleTrans2, so that it is not mistaken for your version.

My features:
1. full language list in source and destination dropdowns
2. support for autodetection of input language
3. confirmation of source/destination languages (including detected language)
4. clean interface sized for the 5800XM screen

It can be downloaded here: http://www.rmx.ro/GoogleTrans2.wgz

It can be tested here:
http://www.rmx.ro/GT.html

I plan on trying to make it scale to any screen but I didn't have the time to test that code yet.

I would also like to add that I have virtually no JavaScript or AJAX experience whatsoever.

W. Seto said...

@Un awesome!