"google translate" vs "translate api"
Asked Answered
I

3

8

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?

Inessential answered 10/11, 2011 at 20:20 Comment(1)
I'm voting to close this question as off-topic because this is a question for Google's technical support.Scutter
Z
19

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 for a while.

I wouldn't recommend translating the bible with it but I've done ~10k words this week without an issue.

If anyone finds another working client value I'd love to know.

Zandra answered 19/11, 2015 at 11:38 Comment(5)
You should also specify your encodings properly otherwise accents will be messed up. &ie=UTF-8&oe=UTF-8 should be included in your URL and don't forget to set the WebClient to Encoding = Encoding.UTF8Aqueous
In 2019, I have been (temporarily ≈ 1-2h) blocked after no more than about 100 requests. Changing public IP works (for this I had to restart my modem).Notecase
@Notecase thanks for the feedback, I've just tried this method again myself and was blocked after ~100 sequential requests in under a minute. During that time a HTML page with a ReCaptcha was being returned instead of the expected response. The requests began succeeding again after several minutes of no requests and without submitting the ReCaptcha.Zandra
I have asked a question to better understand the difference between the different Google API but it hasn't attracted a lot of attention: #57397573Notecase
anyone has any idea how to prevent google not translating a part of a string i tried it with notranslate class and and translate=no but dosent works. like here <p id="textField">You can translate the <span class="notranslate" translate="no" > not this part</span> this by selecting a language in the select box.</p> Clinton
P
4

There is nothing stopping you from using the Google Translate site, other than accessibility. The public API gives you a much tighter integration than, say, trying to embed Google Translate into your site via a frame.

Puparium answered 10/11, 2011 at 20:27 Comment(6)
so what is stopping me from manually crafting some HTTP packets and sending them to Google Translate servers from any C++ app ? The results would be cleanly displayed in some custom UI..Inessential
Nothing, go for it. Just don't be surprised when Google quickly notices a pattern and blocks you. You surely aren't the first person to try it. The question you need to ask yourself: is the time you're going to spend hacking around their site really worth less than the $20 you could pay to use their API? Unless you can make the whole thing work in half an hour of work, I'd say you're cutting yourself short.Puparium
how do they block me :D ? the IP varries, there is no account needed to use the service.. what is "the pattern" ?Inessential
The headers on your packets, for a start. I could think of a handful of ways to detect if someone was abusing my free service, and I'll bet that the guys at Google are a hell of a lot smarter than me. Again, why not just pay the money?Puparium
no way they could ban my app judging by just the headers.. wth! No, I am not going to attempt to abuse it, only to use it :)Inessential
I tried using google translate with public proxies with no luck. Other people are using the same proxies, and Google knows.Achilles
R
1
$translatedText = "प्रशांत कुमार सिंह";
$detectedSourceLanguage = "en";

$url ='https://www.google.com/inputtools/request?text='.urlencode($translatedText).'&ime=transliteration_hi_'.urlencode($detectedSourceLanguage);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_PROXYPORT,3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
$response = curl_exec($ch);
$output = json_decode($response);
$resultText = '';

if($output[0] == 'SUCCESS'){
 if(isset($output[1])){
  if(isset($output[1][0])){
   if(isset($output[1][0][1])){
    $resultText = $output[1][0][1][0];
   }
  }
 }
}
echo  $resultText;
Rorry answered 6/12, 2018 at 11:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.