google-translate

Modifying element from google.translate.TranslateElement results

独自空忆成欢 提交于 2019-12-06 02:35:20
I'm attempting to embed the very convenient Google Translate translate element into a webpage, which is super simple and works great, but I need to change the default text that displays in the resulting HTML: Having worked with a number of Google APIsand js libraries, I figured this would be no problem as it would almost certainly be configurable, but having looked around for some time I can't find any reference to a property that let's you set this, and documentation in general seems to be pitiful. The basic code is: <div id="google_translate_element"></div> <script> function

Implementing google translation api in swift 3 iOS

帅比萌擦擦* 提交于 2019-12-06 02:28:40
问题 Hi i am new to iOS development and i am trying to implement google translation API within my app. I found some sample code online from GitHub https://github.com/prine/ROGoogleTranslate. I downloaded the sample code and followed the instructions provided by obtaining an api key from google cloud translate and placing it within the code however the code is not working, iv looked at the comments on the GitHub site and found that it has worked for other developers. I really don't know what i am

Google translate: Quota Exceeded

一曲冷凌霜 提交于 2019-12-05 21:13:24
I am trying to use Google Translate REST API and while requesting the following url: http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=test&langpair=en|hi&key=mykey I am getting the following response: Response: {"responseData": null, "responseDetails": "Quota Exceeded. Please see http://code.google.com/apis/language/translate/overview.html ", "responseStatus": 403} I am getting this message today only. I have tried using the service after one or two months. Previously it was working perfectly. Has Google stopped the Google translate free service or what? You exceeded your

Detect Google Website Translator change of language

拥有回忆 提交于 2019-12-05 18:27:16
I'm using the Google Website Translator on my website to let the user translate the site on the fly. Using this code: function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'ar,de,el,en,es,fr,it,ja,ko,nl,ru,zh-CN', layout: google.translate.TranslateElement.FloatPosition.BOTTOM_RIGHT}, 'google_translate_element'); } This works great, only thing now is that I need to know which language the user has actually selected. I want to detect both when the user manually selects a language and also when the translator makes an automated

Javascript Promises: Iterate over all object keys arrays and then resolve

回眸只為那壹抹淺笑 提交于 2019-12-05 12:28:14
I have this JS object: let setOfWords = { "nouns": [ "work", "construction", "industry" ], "verbs": [ "work" ], } I'm using the google translate API which calls a REST resource, so I need to wait for the response of each translation and then resolve the same object structure but with the translated words. function translateByCategory(){ let translatedObj = {}; return new Promise(function(resolve, reject){ Object.keys(obj).forEach(function(category){ if (translatedObj[category] == undefined) { translatedObj[category] = []; } setOfWords.forEach(function(word){ google.translate(word, 'es', 'en')

How to pass a string + web url and receive the response using python [closed]

大城市里の小女人 提交于 2019-12-05 11:39:53
I'm using Python and Google Translate. When I click on Listen while translating, a sound file is generated and a URL is passed like so: http://translate.google.com/translate_tts?tl=en&q=text . I want to generate URLs locally using Python then send them to the web and receive these sound files from Google Translate. I tried a lot of URLlib2 and URLparse but I have no clue about what I need to do to make this work. You need to change the user-agent so that the website thinks you are connecting with a browser. Try the following bit of code: import urllib2 url = "http://translate.google.com

Usage of Google Translate API in Android

拥有回忆 提交于 2019-12-05 07:24:48
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 = "en"; String apiLangTarget = "de"; String apiWord = "Hello"; String googleApiUrl = "https://www

Text to Speech 503 and Captcha Now

纵饮孤独 提交于 2019-12-05 07:15:23
问题 I've been using the Google Text to Speech engine for quite some time and today I've started receiving 503s and captcha requests. My original query was https://translate.google.com/translate_tts?tl=en&q=hi Assuming I needed an API Key, I requested a key and added that to the URL query string https://translate.google.com/translate_tts?tl=en&key=xxxxxxx&q=hi However, my service is still receiving the captcha request. I'm assuming that the API has been changed but can't find any documentation to

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

左心房为你撑大大i 提交于 2019-12-05 06:22:20
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 error. localhost:~ me$ wget " http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=hello+world

Random (403) User Rate Limit Exceeded

前提是你 提交于 2019-12-05 03:12:27
I am using translate API to translate some texts in my page, those texts are large html formated texts, so I had to develop a function that splits these texts into smaller pieces less than 4500 characters (including html tags) to avoid the limit of 5000 characters per request, also I had to modify the Google PHP API to allow send requests via POST. I have enabled the paid version of the api in Goole Developers Console, and changed the total quota to 50M of characters per day and 500 requests/second/urser. Now I am translating the whole database of texts with a script, it works fine but at some