Tools

Namespaces

Variants

Views

Actions

Search

Contents

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived.
Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

Contents

Introduction

This article describes the usage of Bing Translation API in your Flash Lite client. This application can translate in various international languages, using the Bing translation engine (version 2.2) provided by Microsoft. Bing Translator (previously Live Search Translator and Windows Live Translator) is a service provided by Microsoft as part of its Bing services which allow users to translate texts or entire web pages into different languages.

Making the Request

I have already discussed how a JSON based client has to be implemented in Flash Lite in google translator api article. SOAP type of web-services are simple to implement with the webserviceconnector component.
In this article, we focus on how XML implementation is done. Before beginning to code the XML usage of the API, we need to understand the request is made as a query and the return is of XML type.

In order to request for data in the XML mode, you can use the loadvars() function in Flash

Here, toTranslate is the sentence to be translated ( after escape() ), src_lang and dest_lang are source and target languages respectively.

Result Processing

In addition after some testing I found that some further processing of text was needed after unescape(). Quotation marks, apostraphe characters has some trouble in getting rendered. Hence I had to handle it myself as follows.

In order to handle the receipt of data, you will need to write a onData function that processes the incoming XML data structure. Parsing an XML tree is again quite simple and to conclude creating a translation engine client is quite simple in Flash Lite.

Screenshots

Note: There is a need for specific fonts on the device for certain fonts to be rendered. For example for text in Chinese, Chinese font has to be supported on the target device. The screen-shots shown are taken from Adobe device central CS3 on a Nokia 5800. The client is built for touch devices. This article is a sequel to the Google Translation API article and certain steps like creating an language -lookup table, escape() and unescape() of the strings are common to both cases and are not discussed in this article.