google-translate

Usage of Google Translate API in Android

我怕爱的太早我们不能终老 提交于 2019-12-07 03:16:28
问题 I have been searching everywhere on the Internet for Google Translate API usage but I wasn't able find descent tutorial or explanation. So, here is what I have done: In my Google API Console I have generated a key under Public API access with my SHA1 Fingerprint using this answer. Here is how my API console looks like: In Android studio I build and send my request using OkHttp library with this code: OkHttpClient client = new OkHttpClient(); String apiKey = "My API key"; String apiLangSource

Why is Google Cloud API trying to connect as an end-user?

萝らか妹 提交于 2019-12-07 01:40:21
问题 I am trying to use the Google Cloud Translate API. I generated a JSON file from a service account and set the GOOGLE_APPLICATION_CREDENTIALS to where the JSON file is saved. I then used it in a program like so: import com.google.cloud.translate.*; ... Translate translate = TranslateOptions.getDefaultInstance().getService(); Translation translation = translate.translate(message); But I get the following error com.google.cloud.translate.TranslateException: Your application has authenticated

Google Translate API text-to-speech: http requests forbidden

空扰寡人 提交于 2019-12-06 23:58:02
问题 I am making a language learning web app that when you hover over the word, it pronounces it for you. I'd like to access the native speaker translations from Google Translate API. I've found this resource which gives http://translate.google.com/translate_tts as the base URL and tl for target language and q for the query string. This works awesome when I just access it in the browser, http://translate.google.com/translate_tts?tl=zh-CN&q=你好, but any httprequests for my app return a 403 Forbidden

R: google translate API (packages 'translate' & ''translateR')

我只是一个虾纸丫 提交于 2019-12-06 15:59:12
问题 I am trying to use the translate and translateR packages with R-Studio. I have created both a 'server' and 'browser' API key. The browser API works fine when running the example: https://www.googleapis.com/language/translate/v2?key=YOUR_API_KEY&q=hello%20world&source=en&target=de However, when using either API key and either package with R-Studio ( translate / translateR ), I obtain an error message. With translate > library(translate) > set.key("mykey") > translate('Hello, world!', 'en', 'de

How to enable Google Transliteration for multiple dynamic Textboxes (ASP.Net)

佐手、 提交于 2019-12-06 13:05:27
Here's the sample (available everywhere) code for integrating Google Transliteration code in ASP.Net Pages. But my question is, how to enable transliteration in TextBoxes which will be generated on runtime? This script demands the ID of the textbox for applying Transliteration. But my textboxes will be generated on runtime. Need an alternative for this line of code: control.makeTransliteratable(['transliterateTextarea']); //Script Starts here // Load the Google Transliterate API google.load("elements", "1", { packages: "transliteration" }); function onLoad() { var options = { sourceLanguage:

Is there any way for more than one Google Translate widget to be loaded on a page

夙愿已清 提交于 2019-12-06 12:35:49
问题 Is there any way possible to load a Google Translate widget in the sidebar and one in the footer, for example. Every way I've tried has only loaded so that both appear in the location of the first instance on the page. 回答1: After a bit of tinkering I kinda felt obligated to solve the puzzle! You can skip to the good part by checking out the jsfiddle: (it works as of now but knowing google it might not tomorrow) http://jsfiddle.net/melfy/15zr6ov0/ Lets begin: First google translate is loaded

In R, how to parse specific frame within a webpage?

断了今生、忘了曾经 提交于 2019-12-06 11:12:35
问题 Greetings all, Is there a way to only read the HTML code from a specific frame within a webpage? For example, if I submit a url to google translate, is there a way to parse only the translated page frame? Whenever I try, I can only access the top frame on the page but not the translated frame. Here is my self-contained sample code: library(XML) url <- "http://www.baidu.com/s?wd=r+project" url.google.translate <- URLencode(paste("http://translate.google.com/translate?js=y&prev=_t&hl=en&ie=UTF

PyInstaller file fails to execute script - DistributionNotFound

妖精的绣舞 提交于 2019-12-06 07:53:47
问题 I'm trying to convert my python file to an executable using PyInstaller. The program uses the Google Cloud Translate API to translate given text between languages. When running python quicktrans.py in the terminal, the program works fine. Then I ran pyinstaller quicktrans.py , SHIFT + right-clicked the directory the executable was in, and ran the .exe file in the terminal. This is the traceback that it spit out (Note this is not the whole traceback because it is a little lengthy): File "c:

Using google Text-To-Speech (TTS) API on iOS

余生长醉 提交于 2019-12-06 06:48:29
问题 I'm using the API with this code: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"file.mp3"]; NSString *text = textToTranslate; //@"You are one chromosome away from being a potato."; NSString *urlString = [NSString stringWithFormat:@"http://www.translate.google.com/translate_tts?tl=en&q=%@",text]; NSURL *url = [NSURL

How to use Google Cloud Translation API in Android Studio?

给你一囗甜甜゛ 提交于 2019-12-06 03:07:01
问题 I am making an android app for language translation and so far I have used voice recognizer intent to get the voice input into a string. Now I want to translate that string into another language and speak the translated text using the TTS Engine. I have created a separate translate_test file just for test use. I have been researching and know that API Key is required in Android Studio. So I have created the API Key and enabled the Google Cloud Translation API . Now I'm trying to import com