How to use the Google API to translate from code
I am trying to create an application that will send a word to translate.google.com, take the translation result and show it to the user. I made up a url but don't know how to extract a word / phrase from a webpage.
Example pseudo: en - code for English and es - code for Spanish
String from = "en";
String to = "es";
String word = "hello"; //this will be user input text really
String URL = "http://www.translate.google.com/#" + from + "/" + to + "/" + word;
Therefore the request url will look like http://www.translate.google.com/#en/es/hello
Now I need to get information from the results window and put it in a string so that I can display it to the user.
+3
user2057343
source
to share
1 answer
Google translate provides an API for receiving translations. You have to use json object and GET request to google translation server. In this link you can find the official developer guide with code examples.
+5
StarsSky
source
to share