Sunday, March 3, 2013

Getting started with the Bing translator API


Bing Translator is the best freely available machine translation API that I know of. If you're interested in getting set up to use the API to make your own translation enabled apps, follow this guide.

Create an Azure marketplace account

1- Go to http://datamarket.azure.com/ and login using a Microsoft live account. If you don't have one, you'll need to create one beforehand. You can do that here.

2- Complete the registration:


3- Once logged in, head on over to the bing translator subscription page and select the free 2,000,000 character/month subscription package.




4- If you go back to your account page under "My data" you should see the following:




Create an Azure application

Once you have an Azure marketplace account with a subscription to Bing translator, the last step is to create an application. By doing this, you'll have a client key and secret you can use to call the API. 

1- Head on over to the application registration page. Once there, fill out all the necessary information. For Bing translator, you won't be using a redirect uri (even though it's mandatory). You can put any valid URI you want to complete the form. ** Before hitting submit, copy the Client secret and Client ID. We'll need these later.

2- If you go back to the application registration page, you should see your app show up:

Call the API

Using the client key and secret from above, you have all you need to call the API. If you're going to be implementing a client to call the API yourself, you'll need to first authenticate in order to get an access token, then use that in the header of your requests for authorization. 



I wrote some sample code(here) that retrieves the access token, before realizing there was a really great client for the translator written already called microsoft-translator-java-api. Here is some sample java code using this library which takes care of authentication and translation requests under the covers:


Here is a more involved project that involves Twitters streaming api and bring translator:

Here are some additional resources you might find useful:

Bonne Chance! Que la force soit avec vous.

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. For an SEO translation, where a few different words can be used to describe the same product or service that you provide, we select the one that is most often searched for, ensuring that you reach as wide an audience as possible online translation. If you interest more please visit.

    ReplyDelete