IBM Research

Translation

Try It Out

If you want to check out the Translation plugin, do the following:

  1. How to setup the plugin:
    • Start WBI and setup your browser to use WBI as a proxy.
    • Register the Translation plugin on the WBI console by typing (on one line):
         register com/ibm/wbi/examples
               /translation/translation .reg
    • Check to see whether the plugin is registered and enabled. Go to the WBI Setup page. The Translation plugin should be listed in the table with a checkmark next to its name. If the plugin is not listed, try registering it again. If the checkmark is not there, click on the box to the left of the plugin name.
    • Open another browser window. Use that window to try out the plugin, and use this window to display the documentation. (To open another window using Microsoft Internet Explorer, go to File -> New -> Window. To open a window using Netscape Navigator, go to File -> New -> Navigator Window.)
  2. How to use the plugin:
    • Configure your browser to use a different preferred language than English. Supported languages for this example include French, Spanish, German and Italian. (In Netscape browsers, choose Edit -> Preferences -> Navigator -> Languages. In Microsoft Internet Explorer, use Tools -> Internet Options -> General -> Languages.)
    • Visit any site on the Internet (i.e., not inside your firewall), such as The WBI Home Page -- you should see the page displayed in the preferred language.


What It Does

This plugin pays attention to the language the user has configured in the browser and seamlessly uses an Internet-based service to translate the document. Some desirable aspects of it are that it leverages an existing user interface (the browser language configuration), and that it does not modify the appearance of the links (if you mouse-over a link and inspect the URL in the statusbar or tooltip, it still looks the same as normal).

The translation is automated and the quality of such a translation is limited to the state of the art. For the purposes of this example, the translation engine from freetranslation.com, a service of Transparent Languages, Inc., is utilized. We have no particular relationship with that company: WBI simply forwards the request to their web site and returns the result to the browser.

The WBI Plugin only sends the URL to freetranslation.com, and freetranslation.com accesses that URL itself and then sends the translated document back to WBI. The WBI Plugin does not send the contents of the document to freetranslation.com. In addition to being more efficient, this also precludes "leaking" private information from inside your firewall (specifically, the URL itself is presented to freetranslation.com, but not the contents of the document to which that URL points).


How It Works

Architecture

The Translation plugin is composed of a single Meg, a Generator, which determines the language translation desired. For example, it might notice that the desired language is Spanish and the original language is English, in which case it sends a request to freetranslation.com to perform that translation. Alternatively, if the desired language is Spanish and the original language is Spanish, then it simply returns the original document, without ever interacting with freetranslation.com.

  • The Translation Generator is used to determine the desired translation and perform it if necessary. It works by determining the desired language from the HTTP request headers; determining the original language by connecting the the original site and inspecting the HTTP response headers; if appropriate, issuing a request to freetranslation.com; returning to the client the data stream either from the original site or freetranslation.com depending upon whether a translation was attempted and successful. It is implemented as a HttpGenerator that responds to all requests for hosts which do not begin with "_" (hostnames with a "_" prepended are illegal in the DNS system and are used for internal WBI purposes including configuration).

Some key WBI classes that were used:

Package com.ibm.wbi.protocol.http
HttpGenerator Extended by TransGenerator.
DocumentInfo Used to inspect headers and the requested URL
HttpRequestHeader Used to determine the preferred language of the client
HttpResponseHeader Used to determine the original language of the document
FetchUrl Used to send a request to the translation service


The Source

TranslationPlugin.java
Contains the class definition for the translation plugin.
translation.reg
Contains the necessary code to register the plugin with WBI. Registration is done through WBI during runtime.
index.html
This file.