To translate using http request to google translate url, require API Key. If you try to view source in Chrome, that translate page doesn't give you anything close to the wording you want. Trying the chrome developer, seems to blocked by some certain mechanism. So they really protect their API right now. Maybe If we can figure out how to use the API key by the regular opening translate site, we can use that in the API.
The other way to do it is to use Google translate app, via Start Activity. The new one use process text.
Start Activity
Action :
android.intent.action.PROCESS_TEXT
Data MIME type :
text/plain
Explicit Component : checked
Package name :
com.google.android.apps.translate
Class name : (leave blank)
Extras :
Code: Select all
putString("android.intent.extra.PROCESS_TEXT", "amazing")
You can get the translation part by using Control UI
Code: Select all
sleep(2000);
translated = getTextByIdAndIndex("com.google.android.apps.translate:id/copydrop_edit_text", 1);
You need to configure your google translate app to the language you want first. Or you can use control UI to set it later.