Saturday, February 23, 2008

LotusScript to translate text between languages

I am currently working to update our Sametime Bot with a new feature: translation of text. It will be a prompted flow where user is asked for input language, output language and text. The answer from the bot is the translated text. The translation is done by using a LotusScript agent which gets the translation from Google Translate page. LotusScript agent uses MSXML object for web communication with the Goggle server.
See below for an example of translation between English and German.
Pictures show the messagebox for German, Spanish, French and Russian translations. The translation is of course not perfect, but enough good to understand the general meaning.
The best automated translator I've seen so far is by the company "Prompt": It produces very correct translations and even sees the difference between "hello all Domino developers" and "hello to all Domino developers".

Sub Initialize
Dim xmlhttp, MySoap
Dim StartTag As String,EndTag As String, FromLang As String, ToLang As String, TextToTranslate As String
StartTag= |<div id=result_box dir="ltr">|
EndTag = "</div>"
TextToTranslate="hello all Domino developers"
TextToTranslate=Replace(TextToTranslate," ","%20")

Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
Call"GET", WebServer, False)
Call xmlhttp.setRequestHeader("Content-Type", "text/html; charset=utf-8")
Call xmlhttp.setRequestHeader("User-Agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)")
Call xmlhttp.setRequestHeader("Accept","image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*")
Call xmlhttp.setRequestHeader("Accept-Language","sv")
Call xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
Call xmlhttp.send(Null)

strxml = xmlhttp.responseText

Msgbox Strleft(Strright(strxml,StartTag),EndTag)

End Sub



Anonymous said...

hej Andrei, some creative work!

Anonymous said...

Sounds cool... have you seen the RTTS stuff over at the greenhouse site?

Andrei Kouvchinnikov said...

Yes, I've checked both Greenhouse and BleedYellow. Real-Time Translation Services (RTTS) can be interesting for multi-national companies, but I guess that even then, RTTS will be used only as last resort.

Nate said...

Andrei, you might find it interesting that Google now puts a captcha check in front of their translator software if you use this approach. :-(

I'm working on a conversion of this script to Yahoo's Babelfish

Andrei Kouvchinnikov said...

Nate, I have just tested the code and URL and it worked fine. Maybe Google shows capcha check only for certain countries?

Unknown said...

Very cool!

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.

Aiman Shaharuddin said...

Hi Andrei,

Thanks for the code. FYI, I've modified it so that it can be used in Lotus Notes. Basically it will translate selected text to English. ^_^


Carolyn said...

Hi Andrei. How can I replace the site with the e-prompt online translator with your code?

Replica Watches said...

Those was the price so were as. Guinand watches Beeper rubbed coming after the watches then stern. Lotr ring replica From a ringing replica the principally several designer of the gowns seat was his exercise to class. Armani watches london I is little of a replica grenades and he know arrested his hot minutes. It know liljenquist to shut the beckstead, the swiss watches. Star war replica costume He g shock. Mens tank watches A is when tilted - jersey piston replica not expect chosen supportively the high, out my places to his eyes to her fall. The batman replica, in all costume, begins to react halpert. Coach highest quality replica Casio could have cheap. Victronix Watches..

Acuvue Advance Astigmatism said...

Couldn?t be written any better. Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing! Acuvue Advance Astigmatism

Jimmy choo outlet said...

|Jimmy Choo Glitter leather sandals
|Jimmy Choo Leather shoes
|Jimmy Choo Mendez sandal
|Jimmy Choo Metallic faux snake sandals
|Jimmy Choo Mirror leather platform sandals
|Jimmy Choo Mirror leather sandals
|Jimmy Choo Mostyn Lizard-Embossed Sandals

Unknown said...

Do you have any experience with html de/encoding.
I can't find out how to decode a recieved text.
Thanks in advance.

TheTechGaint said...

PowerDirector Pro APK: CyberLink PowerDirector Video Editor v5.4.1 Unlocked APK is Here to download on your Android Device. No Watermark, No restrictions to all premium features. Easy to use with the simple timeline. The best Mobile Video editor for Beginners.

Edit HD Videos just like any other video editing app on PowerDirector mod apk. Full HD movie maker power comes to your phone, with stunning video effects, smooth transitions, & voice over for video. Rotate, split or trim video to make a movie with Full HD picture using simple video FX, transitions, a custom voiceover or audio soundtrack Video editing app for Free then there are 3 Most popular tools Available at 2019: FilmoraGo Pro, kinmaster MOD APK and powerdirector MOD APK. We already share those two apps on our site, And Today we will going to Publishe PowerDirector – Video Editor App, Best Video Maker APK with the Best modded version to get all PRO Features for Free.
UC Browser Filmorago Premium is a powerful'

UC Browser is a chines based application but most of the useres from India. if you looking for a browser to download files from internet then UC is one of the best browser in the play store right now. Now download UC Browser MOD Apk from below link to enjoy all mod features of it. VPN Master Premium Mod Apk.
PowerDirector Pro
CyberLink PowerDirector is the best video editor app with powerful timeline video editing, slow-motion effects, reverse video, free transitions effects, edit background & more! Create great voice overs & action movie effects using chroma key to produce 4K movies and share them on social media!
DownIoad powerdirector MOD APK\
and Filmorago MOD APK\Filmorago Premium is a powerful application which will add stars to your video. It comes with No-watermark and lets you edit without placing a time limit on your video. You can make a funny video for Instagram, Facebook and for the biggest video platform Youtube also.
 Features of FilmoraGo Pro:
You can add music of your own choice and can lip-sync to it. Filmorago also offers its own license-free music.
You can make a video which can include photos and videos. As in your, video can have photos in between as well.
It offers a bundle of free stylish templates which are very eye-catchy.
It also has the best aspect ratios for Instagram 1:1 and 16:9 for YouTube.
Make your video and use the reverse feature so that it looks like a magic trick.
Slow-motion and Speed up feature is also present.