Thursday, May 17, 2012

how to translate text from one language to other language through google translation in Android?

What is Google Translation Service?
Google Translate is a free automatic translator. It works without the intervention of human translators, using state-of-the-art technology instead. Google Translate currently supports translation between 57 languages.
How-To use Google Translate API in Android?
Using simple library google-api-translate-java[[]], we can implement google translation with few lines of code.
Steps For integrating google translate api in android app.:
1:)First download jar file from [[]] and add it to project's build path.
2:)After importing library,you can easily translate text by simple code described below:
 Translate.setHttpReferrer("");//here you can use any valid url.It's just for google to know who is consuming their service

        String translatedText=null;
        try {
             translatedText = Translate.execute("How are you", Language.ENGLISH, Language.FRENCH);//here You have to pass text to translate,language of you test and language to translate respectively.
        } catch (Exception e) {


  1. i have downloaded the api.. how to use it with my eclipse.?

    1. Use in your Activity class as per given Code

  2. I want the example project, please....

  3. check

  4. I am getting "Error retrieving translation" error.....What i have to do futher?

  5. Code doesn't work. please give full project