[英]How to use google translation API on Android?
I am trying to use the google translate API in an an andriod app.我正在尝试在一个 Android 应用程序中使用谷歌翻译 API。 Unfortunately I can not find a reasonable way to do this as google cloud java client does not currently support andriod!
不幸的是,我找不到合理的方法来做到这一点,因为谷歌云 java 客户端目前不支持 andriod!
What is the preferred way to do this?这样做的首选方法是什么?
How it works?这个怎么运作?
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
它在后台执行翻译并返回一个带有结果的字符串
Features特征
َAn Example:一个例子:
GoogleTranslate googleTranslate = new GoogleTranslate();
// Perform the translation by invoking the execute method, but first save the result in a String.
// The second parameter is the source language, the third is the terget language
String result = googleTranslate.execute("the text to be translated", "en", "de").get();
UPDATE :更新:
Also checkout this documentation and in github .还可以查看此文档和github 。
Hope it will be help you.希望它会帮助你。
Cloud Translation API 作为 REST API 公开,如文档中所示,因此您可以将它与您最喜欢的 Android HTTP 库一起使用。
您还可以尝试Phrase Phrase 提供了一种使用不同翻译引擎或您选择的选项将用户生成的内容翻译成所需目标语言的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.