google-translate

Google Translate iframe workaround

戏子无情 提交于 2019-11-28 07:01:00
问题 I'm using Google Translate tools to translate a web page and I also have an iframe on this page, that is not obviously translated with the page. Is there a workaround, that any of you know, so I can have the iframe translated as well? 回答1: This is a genuine limitation or policy of Google Translate. You can't rewrite iframe content. But one thing you can do is change iframe url to translated page like: <iframe height="1200" width="600" src="http://translate.google.com/translate?hl=bg&ie=UTF-8

translate a PHP $string using google translator API

吃可爱长大的小学妹 提交于 2019-11-28 07:00:41
been google'ing for a while how is the best way to translate with google translator in PHP, found very different ways converting URLS, or using Js but i want to do it only with php (or with a very simple solution JS/JQUery) example: //hopefully with $from_lan and $to_lan being like 'en','de', .. or similar function translate($from_lan, $to_lan, $text){ // do return $translated_text; } can you give me a clue? or maybe you already have this function.. my intention it's to use it only for the languages i have not already defined (or keys i haven't defined), that's why i wan it so simple, will be

Detect User's Preferred Language and Google Translate Automatically

佐手、 提交于 2019-11-28 06:05:41
I use this script in my site for translation <div id="google_translate_element" align="center"></div> <script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: 'auto', autoDisplay: false, layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element'); } </script> <script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> It is working just fine :) But is there a way to detect the user ip and auto translate when a user go in to my site? Shervin Although you

Google Translate isn't Hidden

佐手、 提交于 2019-11-28 03:51:45
问题 Having opted for the "Automatic" version of Google Translate Widget, I expected not to see the "Select Language" dropdown if my browser was the same language as the site. However, I see it all the time no matter what I set the html lang attribute to or what I set my browsers preferred language to. I have also noticed that it doesn't seem to make any difference whether the meta "google-translate-customization" tag is there or not, the widget is always in view. I'd like the site to just be

“google translate” vs “translate api”

不问归期 提交于 2019-11-28 01:17:39
问题 I hear that the Translate API will be charged for, but what exactly prevents us form using the free Google Translate service here for free ? Otherwise put, what are the limitations of the free service? 回答1: According to the link below, nothing prevents you. https://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=es&dt=t&q=Hello Set your requests content-type to application/json and it fixes the weird formatting, I found the uri pattern after bashing around the google websites

Adding Google Translate to a web site

自闭症网瘾萝莉.ら 提交于 2019-11-27 19:53:57
Looking here Google Translate I get the following code. <meta name="google-translate-customization" content="9f841e7780177523-3214ceb76f765f38-gc38c6fe6f9d06436-c"></meta> <div id="google_translate_element"> </div> <script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element'); } </script> <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> But Looking here html-5

JSONDecodeError using Google Translate API with Python3

牧云@^-^@ 提交于 2019-11-27 15:41:37
I've searched thoroughly on Stack Overflow but couldn't find an answer to this problem. I'm trying to use the Google Translate API (googletrans 2.2.0) for Python (3.6.2) and am trying to translate a set of non-English documents into English. I am letting Google Translate do the language detection. Here is my code: ## newcorpus is a corpus I have created consisting of non-english documents fileids = newcorpus.fileids for f in fileids: p = newcorpus.raw(f) p = str(p[:15000]) translated_text = translator.translate(p) print(translated_text) sleep(10) I am throttling my call to the API by waiting

How to disable google translate from html in chrome

梦想的初衷 提交于 2019-11-27 11:17:24
I just made a website for a french restaurant. The website is in english, but I guess there is enough french on the website (labeled pictures of menu items) to prompt the visitor to translate the website if using Chrome. Is there something I can add to the html to prevent chrome from asking to translate the page? I'd assume it'd be something like <html lang="en"> but that doesn't work. Any ideas? Thanks Matthew Adams Add this tag in between <head> and </head> : <meta name="google" content="notranslate"> Documentation reference The meta tag in the <head> didn't work for me, but class=

GoogleTrans API Error - Expecting value: line 1 column 1 (char 0)

穿精又带淫゛_ 提交于 2019-11-27 09:16:57
I am having this error when translating thousands of text data in an iteration: Expecting value: line 1 column 1 (char 0) My code for translating big amounts of text: translatedList = [] for index, row in df.iterrows(): newrow = copy.deepcopy(row) try: # translate the 'text' column translated = translator.translate(row['text'], dest='en') newrow['translated'] = translated.text except Exception as e: print(str(e)) continue translatedList.append(newrow) I receive this error after translating about 2-3k rows. Kerem I kind of figured out the problem. I think that this is about Google API's request

How to use Google Translate API in my Java application?

风流意气都作罢 提交于 2019-11-27 06:27:58
If I pass a string (either in English or Arabic) as an input to the Google Translate API , it should translate it into the corresponding other language and give the translated string to me. I read the same case in a forum but it was very hard to implement for me. I need the translator without any buttons and if I give the input string it should automatically translate the value and give the output. Can you help out? Use java-google-translate-text-to-speech instead of Google Translate API v2 Java . About java-google-translate-text-to-speech Api unofficial with the main features of Google