0

I tried to use the solution in the this link: How to use Google Translate API in my Java application?

The code:

Translator translate = Translator.getInstance();
String text = translate.translate("Hello!", Language.ENGLISH, Language.ROMANIAN);
System.out.println(text); // "Bună ziua!" 

but the following error appears in my code:

ava.io.IOException: Server returned HTTP response code: 403 for URL: http://translate.google.com.br/translate_a/t?client=t&text=I%20am%20programmer&hl=en&sl=en&tl=pt&multires=1&prev=btn&ssel=0&tsel=0&sc=1
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at com.gtranslate.utils.WebUtils.source(WebUtils.java:24)
at com.gtranslate.parsing.ParseTextTranslate.parse(ParseTextTranslate.java:19)
at com.gtranslate.Translator.translate(Translator.java:37)
at gotranslate.GoTranslate.main(GoTranslate.java:14)
Minions
  • 5,104
  • 5
  • 50
  • 91
  • Does it make sense to provide a code which you've created? Because this is not clear how you built this URL. By the way it is not available even through the browser, which means that log says correct things. – Mikita Berazouski Oct 02 '17 at 17:39
  • Edited .. @MikitaBerazouski – Minions Oct 02 '17 at 18:09

1 Answers1

0

All previous libraries to use Google tools are blocked, the only way to use them is by using Google Cloud Platform:

Google returned the following error: [403] Please use Translate v2.  See http://code.google.com/apis/language/translate/overview.html
Minions
  • 5,104
  • 5
  • 50
  • 91