google-translate

Error : More than one file was found with OS independent path 'META-INF/LICENSE'

ぐ巨炮叔叔 提交于 2019-12-11 16:52:40
问题 I having android app where I'm using google translate API When I build, I got Error : Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. More than one file was found with OS independent path 'META-INF/LICENSE' 回答1: try adding packagingOptions { pickFirst "**" } OR packagingOptions { pickFirst 'META-INF/LICENSE' } OR packagingOptions{ exclude 'META-INF/LICENSE' } 回答2: try adding these lines in your app level gradle file packagingOptions { exclude 'project

Using java-google-translate-text-to-speech on android

偶尔善良 提交于 2019-12-11 14:43:56
问题 I need to translate inputed text from one language to another, trying to use this but have problem. This code: Thread one = new Thread() { public void run() { try { Translator translate = Translator.getInstance(); String text = translate.translate("I am programmer", Language.ENGLISH, Language.PORTUGUESE); Log.d("TEXT: ",text); } catch(Exception v) { Log.d("ERR: ", v.toString()); } } }; one.start(); Throws error: W/System.err: java.io.FileNotFoundException: http://translate.google.com.br

TypeError: Translate is not a constructor

时光毁灭记忆、已成空白 提交于 2019-12-11 14:33:17
问题 This is the code for transalting english to ru 'use strict'; const {Translate} = require('@google-cloud/translate'); const projectId = 'godwin-feb8f'; const translate = new Translate({ projectId: projectId, }); const text = 'Hello, world!'; const target = 'ru'; translate .translate(text, target) .then(results => { const translation = results[0]; console.log(`Text: ${text}`); console.log(`Translation: ${translation}`); }) .catch(err => { console.error('ERROR:', err); }); TypeError: Translate

Translate API User Rate Limit Exceeded [403] without reason

家住魔仙堡 提交于 2019-12-11 13:08:20
问题 I use google translate API with C# code via "Google.Apis.Translate.v2" version 1.9.2.410 with paid service. Code is some like: var GoogleService = new Google.Apis.Translate.v2.TranslateService( new BaseClientService.Initializer { ApiKey = Context.ConfigData.GoogleApiKey, ApplicationName = "Translator" }); ... var rqr = GoogleService.Translations.List(item, 'de'); rqr.Source = "cs"; var result = await rqr.ExecuteAsync(); This code take Exception: User Rate Limit Exceeded [403] Errors [ Message

Two Google Translator Widget for Responsive Layout

偶尔善良 提交于 2019-12-11 11:22:47
问题 I recently faced an issue for adding one more GoogleTranslator widget in my web page. I did some research apparently Google won't allow more than one GoogleTranslator widget in template. Does anyone have experienced the same issue? Is there any solution? In responsive Design I need to duplicate some blocks and use them in different orders. 回答1: Create two container divs - one for your "normal" layout, one for your "mobile" layout (or more, depending on what you're doing). Have the widget

Getting the languages from Language class

隐身守侯 提交于 2019-12-11 10:37:29
问题 I use this Unofficial Java Google Translate API to translate a text from a language to another language. I have Language class that contains the all language names like in the image bellow: I want to get an array with the languages names. How can I do this? If it would be C# I would do this: PropertyInfo[] languages; languages = typeof(Language).GetProperties(); 回答1: You can get all the fields with Field[] fields = Language.class.getDeclaredFields(); for(Field field: fields) if (field.getType

Scraping HTML from Google Translate

僤鯓⒐⒋嵵緔 提交于 2019-12-11 10:15:55
问题 I want to translate a string using Google Translator. My sample string is "this is my string" . I want to use HTML Agility Pack to parse HTML documents. I tried this: using HtmlAgilityPack; ........ var webGet = new HtmlWeb(); var document = webGet.Load( "http://translate.google.com/#en/bn/this%20is%20my%20string"); var node = document.DocumentNode.SelectNodes( "//span[@class='short_text' and @id='result_box']"); if (node != null) { foreach (var xx in node) { x = xx.InnerText; MessageBox.Show

JS - Modify bookmarklet for Google Translate

北慕城南 提交于 2019-12-11 09:48:11
问题 This page offers bookmarklets to be used with Google Translate http://translate.google.com/translate_buttons however those bookmarklets opens the Google Translate in same tab/window and replaces the original page. How to modify the bookrmarklet code (see bellow) to open in new window/tab? Also can somebody please briefly explains what the code is really doing. Thanks a lot. javascript: var t = ((window.getSelection && window.getSelection()) || (document.getSelection && document.getSelection()

Google Website Translator: TypeError when clicking “Contribute” button

a 夏天 提交于 2019-12-11 09:37:50
问题 We use the standard Google Website Translator gadget on our site http://ut.no. The "Contribute a better translation" feature has stopped working. When you click on the "Contribute" button, you get this javascript error: TypeError: undefined is not an object (evaluating 'a[hd][H]') in "element_main.js" injected by Google. This worked fine several weeks ago. Are anyone else having this problem, or is it only us? After some testing, I fond out that it's the meta tag from Google that's part of

Google Translate override select change event

末鹿安然 提交于 2019-12-11 09:17:22
问题 I've got a wierd issue: <div id="translate"> <a href="#" id="google-translate" title="Google translate">Translate</a> <div id="google_translate_element" style="display:none"> <script> function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: "sv" }, "google_translate_element"); }; </script> </div> </div> Which gives me the following: <div class="skiptranslate goog-te-gadget" style=""> <div id=":1.targetLanguage"> <select class="goog-te-combo"> </select> <