vijaymoorthy001 / google-api-translate-java

Automatically exported from code.google.com/p/google-api-translate-java
0 stars 0 forks source link

[google-api-translate-java] Error retrieving translation. #156

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hey!
First of all thanks for this API. I was using it a lot until Google decided to 
block the first one.

Now, Im just trying to debug my old application and update it to work with 
APIv2.

I enabled the billing from Google and got my API Key. I linked the new 
libraries and did the follow changes to the code:

###################################
    //API v1 Code
    try
    {
      Translate.setHttpReferrer("http://www.google.com");
      this.translatedText = Translate.execute(text, this.from, this.to);
    } catch (Exception e) {
      this.translatedText = ("Translation failed: " + e.getMessage());
    }
###################################
    //API v2 Code
    try
    {
      GoogleAPI.setHttpReferrer("MyWebsite");
      GoogleAPI.setKey("MyAPIkey");
      this.translatedText = Translate.DEFAULT.execute(text, this.from, this.to);
    } catch (Exception e) {
      this.translatedText = ("Translation failed: " + e.getMessage());
    }
###################################

After the first tests the output is:

"Translation failed: java.lang.Exception: [google-api-translate-java] Error 
retrieving translation."

I tried to turn off any firewall software but the problem persists.
Any ideas?

Thanks in advance!

Original issue reported on code.google.com by leph...@gmail.com on 10 Dec 2011 at 2:20

GoogleCodeExporter commented 9 years ago
Hello I am having same issue on this, does anyone have solution to this.
I am also using version 2 of the API.

Original comment by aben2da...@gmail.com on 14 Jan 2013 at 7:50