[dba-VB] Google Translate API

Salakhetdinov Shamil mcp2004 at mail.ru
Fri Feb 17 03:53:05 CST 2012


Hi Gustav --

Yes, in fact it will not be that slow I guess but it will be a bit "spamming & cheating" approach....

That would be several lines of code in C#:

To translate "Event Viewer" into Russian one can use WebClient class to submit:

http://translate.google.com/#en|ru|Event%20Viewer

URL and then grab words between

<span class="hps">

and 

</span>

=>

<span class="hps">Event Viewer</span>

BTW: If you use the above URL in your browser you'll see that "Event Viewer" doesn't get translated by Google even in browser...

And this "grabbing scenario"  will work for any target language translation - you can try the following URL to translate into Danish:

http://translate.google.com/#en|da|Event%20Viewer

Google translate API isn't that quicker than "grabbing approach" but I'd still use API - just wanted to invest some money into Google business as I do use GMail and some of the Google services for free for many years and I like them :)

And using grabbing approach one can run it in several threads in fact making it quicker than using API - API I expect should somehow block multi-threading calls but I haven't checked it, so I can be wrong...

Thank you.

-- Shamil


17 февраля 2012, 13:21 от "Gustav Brock" <Gustav at cactus.dk>:
> Hi Shamil
> 
> You can "attack" the web interface via code. It's very easy - you post the wording to be translated, grab the returned html stream, and parse it for the returned translation. Much slower than the API, of course, but totally free as far as I understand. I didn't check for upper/lower case issues however.
> 
> I have code for it somewhere should anyone be interested.
> 
> /gustav
> 
> >>> Salakhetdinov Shamil <mcp2004 at mail.ru> 16-02-2012 14:50 >>>
> Hi All --
> 
> JFYI: I have tried to use .NET Google Translate API today (http://code.google.com/p/google-api-dotnet-client/wiki/Setup) and it worked rather well - rather well because it somehow failed to translate words "Event Viewer" into Russian but translated them well into French. And http://translate.google.com/ is able to translate words "Event Viewer" well into Russian...
> 
> Google Translate API also translated well lowcased words "event viewer" into Russian.
> 
> Google Translate API is a paid service - USD20 for 1 million translated chars - so to not waste money (I need to translate about 800,000 chars) I'd probably need to submit only lowcased words to Google Translation API. We will see.
> 
> Thank you.
> 
> -- Shamil
> 
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 
> 



More information about the dba-VB mailing list