Translate text in Android using Google Cloud Translation API
Android Java class translates text using Google Cloud Translation API
It takes three parameters, the text which will be translated, the source language and the target language. It performs the translation in background and returns a string with the result
- Translating text using Google Cloud Translation API
- Only one short class thus Easy to use and understand
- Clone the repository or download the class from src and put it somewhere in your project folder
- Import the package
- Create an object of the class
GoogleTranslate googleTranslate = new GoogleTranslate();
- Perform the translation by invoking the execute method, but first save the result in a String:
String result = googleTranslate.execute("the text to be translated", "en", "de").get();
- The second parameter is the source language, the third is the terget language
- Do whatever you want with the result!
The Class is licensed under the GNU General Public License v3.0