# Google translate ruby client api 0.1

**URL:** <https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351>\
**Category:** Ruby\
**Created:** [November 16, 2007, 12:49am UTC](https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351 "2007-11-16T00:49:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sishen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sishen](https://www.ruby-forum.com/u/sishen)\
**Post date:** [November 16, 2007, 12:49am UTC](https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351/1 "2007-11-16T00:49:03Z")

</div>

> **[LifeGoo.com is for sale | HugeDomains](https://www.hugedomains.com/domain_profile.cfm?d=lifegoo.com)**
>
> Secure the right domain name for your business or website today. Custom tailored payment plans available to fit any budget.

Hi, guys. I wrote a ruby client api fro google translate service, then i  
can  
get the answer directly from the terminal, instead of the browser.  
It’s really convenient for me. Enjoy it, 🙂

_Install_

sudo gem install rtranslate

_Usage_

sishen@lifegoo:~$ irb -rubygems  
irb(main):001:0\> require ‘rtranslate’  
=\> true  
irb(main):002:0\> $KCODE = ‘u’  
=\> “u”  
irb(main):003:0\> result = Translate.t(“china”, Language::ENGLISH,  
Language::CHINESE\_SIMPLIFIED)  
=\> “ä¸­å›½”  
irb(main):004:0\> result = Translate.t(“china”, Language::ENGLISH,  
Language::JAPANESE)  
=\> “ä¸­è¯äººæ°‘å…±å’Œå›½”  
irb(main):005:0\> result = Translate.t(“china”, Language::ENGLISH,  
“zh-TW”)  
=\> “ä¸­åœ‹”

Really very easy to use, I think. And the source is hosting on  
[http://rtranslate.googlecode.com](http://rtranslate.googlecode.com). Enjoy it.

---

<div class="post-metadata">

**Author:** ![sishen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sishen](https://www.ruby-forum.com/u/sishen)\
**Post date:** [November 16, 2007, 1:10am UTC](https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351/2 "2007-11-16T01:10:40Z")

</div>

Quoth sishen:

> _Usage_  
> Language::JAPANESE)  
> =\> “ä¸­è¯äººæ°‘å…±å’Œå›½”  
> irb(main):005:0\> result = Translate.t(“china”, Language::ENGLISH, “zh-TW”)  
> =\> “ä¸­åœ‹”
> 
> Really very easy to use, I think. And the source is hosting on  
> [http://rtranslate.googlecode.com](http://rtranslate.googlecode.com). Enjoy it.

Very cool. Do you plan on adding a command-line tool as well? That would  
make  
it even easier to use at a terminal. If you need examples, you could  
look at  
the (IMO) excellent metadata gem.

Thanks,

---

<div class="post-metadata">

**Author:** ![sishen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sishen](https://www.ruby-forum.com/u/sishen)\
**Post date:** [November 16, 2007, 7:49am UTC](https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351/3 "2007-11-16T07:49:53Z")

</div>

a good idea. I’ll do it tonight, 🙂

---

<div class="post-metadata">

**Author:** ![sishen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sishen](https://www.ruby-forum.com/u/sishen)\
**Post date:** [November 16, 2007, 10:30am UTC](https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351/4 "2007-11-16T10:30:22Z")

</div>

Comand line tool is ok.

Now you can use rtranslate as below:

$rtranslate -f en -t zh-CN china

Get the gems from [http://rtranslate.googlecode.com](http://rtranslate.googlecode.com). Enjoy. 🙂

---

<div class="post-metadata">

**Author:** ![sishen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sishen](https://www.ruby-forum.com/u/sishen)\
**Post date:** [November 19, 2007, 2:43pm UTC](https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351/5 "2007-11-19T14:43:33Z")

</div>

On Nov 15, 2007 11:48 PM, sishen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [LifeGoo.com is for sale | HugeDomains](http://sishen.lifegoo.com/?p=51)
> 
> Hi, guys. I wrote a ruby client api fro google translate service, then i can  
> get the answer directly from the terminal, instead of the browser.  
> It’s really convenient for me. Enjoy it, 🙂

I have written similar tools using Watir, but one thing I noticed is  
that google  
translate doesn’t like you using bots - it hit me with a capcha.

Does this library handle this? Or is it just something that you are  
supposed  
to use responsibly.

Admittedly I was being an ass about it, and trying to translate all of  
my applications  
resource files.

As an aside, does anyone know of any online services that allow you  
unlimited  
(for pay) machine translation?

---

<div class="post-metadata">

**Author:** ![sishen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sishen](https://www.ruby-forum.com/u/sishen)\
**Post date:** [November 19, 2007, 9:31pm UTC](https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351/6 "2007-11-19T21:31:02Z")

</div>

sorry, personally i haven’t met the problem. It has never asked me to  
input  
the captcha to go through.  
I think maybe your translation is too heavy and have automatically  
recognized by the server.

Also, if you still meet the problem with rtranslate, please give me a  
feedback and i’ll try to fight with it. 🙂

---

<div class="post-metadata">

**Author:** ![sishen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sishen](https://www.ruby-forum.com/u/sishen)\
**Post date:** [November 20, 2007, 4:38pm UTC](https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351/7 "2007-11-20T16:38:37Z")

</div>

On Nov 19, 2007 8:30 PM, sishen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> sorry, personally i haven’t met the problem. It has never asked me to input  
> the captcha to go through.  
> I think maybe your translation is too heavy and have automatically  
> recognized by the server.

Yeah, it was pretty brutal alright, some java properties files with  
~3000 entries.  
For Rtranslate, it might be best to have some kind of custom exception  
in case  
you found it.

> Also, if you still meet the problem with rtranslate, please give me a  
> feedback and i’ll try to fight with it. 🙂

Lol! I would probably stay away from trying to work around  
Captcha/Kismet/whatever.

I need google too much for work for them to pile on sanctions…

---

<div class="post-metadata">

**Author:** ![sishen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sishen](https://www.ruby-forum.com/u/sishen)\
**Post date:** [November 16, 2007, 9:04pm UTC](https://www.ruby-forum.com/t/google-translate-ruby-client-api-0-1/120351/8 "2007-11-16T21:04:20Z")

</div>

Quoth sishen:

> > a good idea. I’ll do it tonight, 🙂
> > 
> > > > It’s really convenient for me. Enjoy it, 🙂  
> > > > irb(main):002:0\> $KCODE = ‘u’
> > > 
> > > ## Thanks,
> > > 
> > > Konrad M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [http://konrad.sobertillnoon.com/](http://konrad.sobertillnoon.com/)

Cool, thanks.
