September 22, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Online Translations: Get your Programs Speaking Spanish, in Seconds!

  • November 13, 2003
  • By Karl Moore
  • Send Email »
  • More Articles »

The Babel Fish is one of Douglas Adams's famed creations, an enormous green scaly amphibian that, when held to the ear, enables you to instantly understand any language. It's a concept that search engine AltaVista soon cottoned onto, with their online translation service at babelfish.altavista.com. It's pretty good, too: Just tap in a site address or block of text, select a language, and off you go!

It's no longer limited to just the Web, however. Some bright spark at XMethods (www.xmethods.com) created a Web service interface to the site, meaning you can plug the translation feature straight into your Windows programs, mobile Web applications, or anywhere else. And the service is exceptionally easy to use, too.

To get started, fire up Visual Studio .NET and create a new project, such as a Windows application. Select Project ~TRA Add Web Reference, and type in the URL of the Babel Fish WSDL (Web Service Definition Language) file—http://www.xmethods.net/sd/2001/BabelFishService.wsdl—then press Return. Click on Add Reference when the button becomes available.

Now, this service has only one simple function, BabelFish. It accepts two parameters: a translationmode and sourcedata. The sourcedata is quite simply the text you wish to translate, and the translationmode can be any of the following values, depending on the languages you wish to translate between:

Translation Languages "translationmode" value
English to French en_fr
English to German en_de
English to Italian en_it
English to Portugese en_pt
English to Spanish en_es
French to English fr_en
German to English de_en
Italian to English it_en
Portugese to English pt_en
Russian to English ru_en
Spanish to English es_en

Want to get started? Simply create a new instance of the BabelFishService stub class created for you and call the BabelFish function with these parameters, like this:

  Dim objTranslate As New net.xmethods.www.BabelFishService()
  Dim strText = objTranslate.BabelFish("fr_en", "comment traduire")
  MessageBox.Show(strText)

And that's quite simply it. A small service, yes, but extremely powerful. To learn more about this service, including supported languages and character limitations, check out the link at the bottom of the XMethods site. Excellent!

About the Author

Karl Moore (MCSD, MVP) is an experience author living in Yorkshire, England. He is author of numerous technology books, including the new Ultimate VB .NET and ASP.NET Code Book (ISBN 1-59059-106-2, $49.99), plus regularly features at industry conferences and on BBC radio. Moore also runs his own creative consultancy, White Cliff Computing Ltd. Visit his official Web site at www.karlmoore.com.






Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel