BabelFish Web Service
The BabelFish translation service at
XMethods (http://www.xmethods.net) is a sample
that can be implemented easily with a couple of text fields, a combo
box, and a button. With a few lines of ActionScript code, you can put
language translation functionality into a Flash movie and into your
site. The BabelFish method at
http://www.xmethods.net/sd/2001/BabelFishService.wsdl
takes two arguments: translationmode and
sourcedata.
The translationmode argument is a special code for
the two languages used in the translation, as shown in Table 10-2. This data is displayed in a combo box named
language_cb.
|
From |
To |
translationmode |
|
English |
French |
en_fr |
|
English |
German |
en_de |
|
English |
Italian |
en_it |
|
English |
Portuguese |
en_pt |
|
English |
Spanish |
en_es |
|
French |
English |
fr_en |
|
German |
English |
de_en |
|
Italian |
English |
it_en |
|
Portuguese |
English |
pt_en |
|
Russian |
English |
ru_en |
|
Spanish |
English |
es_en |
The sourcedata argument is the text that you want
translated (limited to a string of 150 characters or less). The Flash
UI, shown in Figure 10-2, allows the user to type
into the from_txt text field, choose a language
translation from the combo box, click a button, and get the result in
a text field named to_txt.
![]() |
The client-side ActionScript code is shown in Example 10-4, using ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
