google-translate

Google Translate API outputs HTML entities

谁说胖子不能爱 提交于 2019-12-08 18:46:49
问题 ENGLISH: Sale ID prefix is a required field FRENCH: Vente préfixe d'ID est un champ obligatoire Is there a way to have google translate NOT output the html entity and instead output the actual character (') CODE: (SEE translateTo ) #!/usr/bin/php <?php $languages = array('english' => 'en', 'spanish' => 'es', 'indonesia' => 'id', 'french' => 'fr', 'italian' => 'it', 'dutch' => 'nl', 'portugues' => 'pt', 'arabic' => 'ar'); fwrite(STDOUT, "Please enter file: "); $file = trim(fgets(STDIN)); //Run

Error while trying to access Google translate with NSURL

假装没事ソ 提交于 2019-12-08 08:56:12
问题 If I try this code: NSError *err = nil; NSString *resp = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=abdicate&langpair=en|es"] encoding:NSASCIIStringEncoding error:&err]; Err contains the following message: Error Domain=NSCocoaErrorDomain Code=258 UserInfo=0x1001166d0 "The file name is invalid." Anybody knows what this means? If I try the url on a browser, it works fine. 回答1: (Using NSData ) you can just replace

Why “Googletrans.Translator” suddenly stopped working?

南楼画角 提交于 2019-12-08 08:39:43
问题 I wrote a few lines using Translator function in Googletrans a few days ago. But I was trying to re-run those lines today and it popped a series of errors... I'm really confused by this. If you have experienced similar issue, please comment below. Any help is welcome!! from googletrans import Translator translator = Translator() trans1 = translator.translate('Hello', dest = 'es') The error I got is following: AttributeError Traceback (most recent call last) <ipython-input-19-c0f9e5495a2f> in

Google Translate on Javascript-generated content

不问归期 提交于 2019-12-08 07:02:32
问题 Is there any way to translate content that is generated from user form input when using Google Translate (using the method I employ below)? Right now, the page will translate, but when a user fills in and submits the form on a translated page, the answer, of course, is returned in English. This makes sense, since the translation takes place prior to the form submission (and takes place on Google's servers). Is there any relatively simple way around that? I'm still feeling my way around

Translating parts of datasets with R

匆匆过客 提交于 2019-12-08 03:36:42
问题 I am intending on translating simple text in string variables in datasets with R. I have looked at the translateR package but following the example in the help file I stumbled across the need for a Google API access. This is not a free service as I have become aware. There are other APIS (Bing for example) but I guess there is no way in R to get to it? Any ideas on how to mass translate certain string data in a data frame? Or what I could look into? 回答1: It's all in the manual: ?translateR:

Why “Googletrans.Translator” suddenly stopped working?

落爺英雄遲暮 提交于 2019-12-08 02:49:28
I wrote a few lines using Translator function in Googletrans a few days ago. But I was trying to re-run those lines today and it popped a series of errors... I'm really confused by this. If you have experienced similar issue, please comment below. Any help is welcome!! from googletrans import Translator translator = Translator() trans1 = translator.translate('Hello', dest = 'es') The error I got is following: AttributeError Traceback (most recent call last) <ipython-input-19-c0f9e5495a2f> in <module>() ----> 1 trans1 = translator.translate('Hello', dest = 'es') ~\AppData\Local\Continuum

Encode in webclient unexpected result

China☆狼群 提交于 2019-12-07 11:26:35
问题 I try use webclient to translate word 'Banana' into rus private void button1_Click(object sender, EventArgs e) { Navigate("http://translate.google.ru/translate_a/t?client=x&text=Banana&hl=en&sl=en&tl=ru"); } private void Navigate(String address) { WebClient client = new WebClient(); client.Proxy = WebRequest.DefaultWebProxy; client.Credentials = new NetworkCredential("user", "password", "domain"); client.Proxy.Credentials = new NetworkCredential("user", "password", "domain"); string

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

▼魔方 西西 提交于 2019-12-07 11:24:00
问题 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) {

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

妖精的绣舞 提交于 2019-12-07 05:59:17
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . 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

How to use Google Translate in Matlab?

守給你的承諾、 提交于 2019-12-07 03:44:45
问题 I am writing a program to list all unique words in a movie subtitle file using Matlab. Now I have a unique word list that I want to translate to my language and learn the meaning before watching the movie. Does anyone know how can I use Google Translate in Matlab so that I can complete my script? Is there any web service or so, and how can I use it in Matlab? Thanks, Appendix 1: I have found this code useful: %build url and send to google url = 'http://ajax.googleapis.com/ajax/services