# \[ANN\] babelfish 0.0.1

**URL:** <https://www.ruby-forum.com/t/ann-babelfish-0-0-1/156579>\
**Category:** Ruby\
**Created:** [December 30, 2008, 10:03am UTC](https://www.ruby-forum.com/t/ann-babelfish-0-0-1/156579 "2008-12-30T10:03:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [December 30, 2008, 10:03am UTC](https://www.ruby-forum.com/t/ann-babelfish-0-0-1/156579/1 "2008-12-30T10:03:36Z")

</div>

# babelfish : Ruby interface to Yahoo! BabelFish translation service

This is a completely _unofficial_ (and incredibly simple) Ruby  
interface to the Yahoo! BabelFish translation service. Enjoy!

The source code is [available via  
Git](http://github.com/sunaku/babelfish/tree/master).

## Installation

Run the following command to install this library:

```
sudo gem install babelfish

```

## Usage: Command Line

Here are some examples of using the command-line interface:

```
# echo "Hello world!" | babelfish en es
Â¡Hola mundo!

# echo "How are you?" > foo.txt
# babelfish en es foo.txt
Â¿CÃ³mo estÃ¡ usted?

```

Run `babelfish --help` to see the list of supported languages.

## Usage: Ruby Library

Here is an example of using the library in Ruby:

```
require 'rubygems'
require 'babelfish'

input_text = "I am well, thank you."
input_code = "en"

puts input_text
BabelFish::LANGUAGE_PAIRS[input_code].each do |output_code|
  print " in #{BabelFish::LANGUAGE_NAMES[output_code]} is: "
  puts BabelFish.translate(input_text, input_code, output_code)
end

```

The result of running the above example is:

```
I am well, thank you.
  in Italian is: Sono bene, grazie.
  in Japanese is: ç§ã¯å…ƒæ°—ã§ã„ã‚‹ã€ã‚ã‚ŠãŒã¨ã†ã€‚
  in German is: Ich fÃƒehle mich gut, danke.
  in French is: Je vais bien, merci.
  in Spanish is: Estoy bien, gracias.
  in Russian is: Ð¯ Ð½Ð°Ð¸Ð»ÑƒÑ‡ÑˆÐ¸Ð¼ Ð¾Ð±Ñ€Ð°Ð·Ð¾Ð¼, Ð²Ñ‹.
  in Chinese-simp is: æˆ‘å¾ˆå¥½ï¼Œè°¢è°¢ã€‚
  in Portuguese is: Eu sou bem, obrigado.
  in Korean is: ë‚˜ëŠ” ìž˜ ìžˆë‹¤, ë‹¹ì‹ ì„ ê°ì‚¬í•˜ì‹­ì‹œì˜¤.
  in Chinese-trad is:
  in Greek is: Î•Î¯Î¼Î±Î¹ ÎºÎ±Î»Î¬, ÏƒÎ±Ï‚ ÎµÏ…Ï‡Î±ÏÎ¹ÏƒÏ„ÏŽ.
  in Dutch is: Ik ben goed, dank u.

```

Read the RDoc documentation for more information.

## License

Copyright 2007 Suraj N. Kurapati [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Permission to use, copy, modify, and distribute this software for any  
purpose with or without fee is hereby granted, provided that the above  
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES  
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF  
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES  
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN  
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

* * *

Visit http://snk.tuxfamily.org/lib/babelfish/ for more information.

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [December 30, 2008, 4:15pm UTC](https://www.ruby-forum.com/t/ann-babelfish-0-0-1/156579/2 "2008-12-30T16:15:05Z")

</div>

wow… this is great!!!  
thanks for sharing, suraj…

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [December 30, 2008, 10:02pm UTC](https://www.ruby-forum.com/t/ann-babelfish-0-0-1/156579/3 "2008-12-30T22:02:39Z")

</div>

right, ver cool!

2008/12/30 Suman G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [January 1, 2009, 8:26am UTC](https://www.ruby-forum.com/t/ann-babelfish-0-0-1/156579/4 "2009-01-01T08:26:49Z")

</div>

Great, but also take a look  
here[http://bermonruf.wordpress.com/2008/05/02/metodo-para-traduzir-string](http://bermonruf.wordpress.com/2008/05/02/metodo-para-traduzir-string)  
,  
just see the code.

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [December 31, 2008, 5:23am UTC](https://www.ruby-forum.com/t/ann-babelfish-0-0-1/156579/5 "2008-12-31T05:23:52Z")

</div>

That’s awesome. I can see having a lot of fun with this.

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [January 1, 2009, 8:48am UTC](https://www.ruby-forum.com/t/ann-babelfish-0-0-1/156579/6 "2009-01-01T08:48:41Z")

</div>

Bernardo Rufino wrote:

> Great, but also take a look here, just see the code.  
> [Método Para Traduzir String | Bernardo Rufino](http://bermonruf.wordpress.com/2008/05/02/metodo-para-traduzir-string)

I agree, the basic mechanism is the same as the core logic[1](http://github.com/sunaku/babelfish/tree/master/lib/babelfish.rb) of my gem.
