tranexp

Get Version

1.1.0

→ ‘tranexp nor eng’

What

Translates words or phrases from one language to another, using tranexp website

Installing

sudo gem install tranexp

The basics

Has a command-line and API.

Caches results in a local YAML file to make subsequent requests for same query faster.

REQUIRES: ‘HOME’ environment variable set to a folder.

Command Line

To translate some text from Danish to English:

cat some_danish_text.txt | tranexp dan eng

echo "jeg ville like en flaske vin" | tranexp nor
I would like a bottle of wine

That is, you pass the input text via STDIN. The default target language is English (‘eng’).

API

To translate some text from English to Norwegian:

translate = Tranexp::Http.new
english = translate.translate("metoder", Tranexp::Http::Norwegian, Tranexp::Http::English)
english = translate.translate("metoder", "nor", "eng")

Or use the dynamic helper:

translate.from_nor_to_eng("metoder")

Translations

Tranexp supports translations between the following languages:

{
  "English" => "eng",
  "BrazilianPortuguese" => "pob",
  "Bulgarian" => "bul",
  "Croatian" => "cro",
  "Czech" => "che",
  "Danish" => "dan",
  "Dutch" => "dut",
  "Spanish" => "spa",
  "Finnish" => "fin",
  "French" => "fre",
  "German" => "ger",
  "Greek" => "grk",
  "Hungarian" => "hun",
  "Icelandic" => "ice",
  "Italian" => "ita",
  "Japanese" => "jpn",
  "Latin American Spanish" => "spl",
  "Norwegian" => "nor",
  "Filipino" => "tag",
  "Polish" => "pol",
  "Portuguese" => "poe",
  "Romanian" => "rom",
  "Russian" => "rus",
  "Serbian" => "sel",
  "Slovenian" => "slo",
  "Swedish" => "swe",
  "Welsh" => "wel",
  "Turkish" => "tur",
  "Latin" => "ltt"
}

Forum

http://groups.google.com/group/drnicutilities

How to submit patches

Read the 8 steps for fixing other people’s code and for section 8b: Submit patch to Google Groups, use the Google Group above.

You can fetch the source from either:

git clone git://rubyforge.org/tranexp.git
git clone git://github.com/drnic/tranexp.git

Build and test instructions

cd tranexp
rake test
rake install_gem

License

This code is free to use under the terms of the MIT license.

Contact

Comments are welcome. Send an email to Dr Nic Williams via the forum

Dr Nic Williams, 21st April 2008
Theme extended from Paul Battley