Termit Build Status Gem Version

Termit is an easy way to use Google Translate in your terminal. It does not use paid Google Translate API but instead it headlessly browses www.translate.google.com and parses the response.

Installation

gem install termit

Usage

termit 'source_language' 'target_language' 'text'

Example:


termit en es "hey cowboy where is your horse?"
=> "Hey vaquero dónde está tu caballo?"

termit fr en "qui est votre papa?"
=> "Who's Your Daddy?"

Parenthesis are not necessary for text data input:

termit fr ru qui est votre papa?
=> "Кто твой папочка?"

Speech synthesis

Specify a -t (talk) flag to use speech synthesis:

termit en zh "hey cowboy where is your horse?" -v
=> "嘿,牛仔是你的马在哪里?" #and a chinese voice says something about a horse

Synonyms

Specify a -s (synonyms) flag to get the list of synonyms if available:

termit es en muchacho -s
=> boy
=> Synonyms: boy, lad, youngster, laddie, cully

Language codes:

  • english - en
  • polish - pl
  • french - fr
  • spanish - es
  • slovakian - sk
  • chinese - zh
  • russian - ru
  • automatic source language detection - auto

To find all available language codes visit www.translate.google.com. Choose langauges and their codes will appear in the url.

Requirements

Works with Ruby 1.9.2 and higher.

To use speech synthesis (yes it talks) you need to have mpg123 installed.

For Ubuntu:

sudo apt-get install mpg123

For MacOSX:

brew install mpg123

Any feedback will be appreciated. You can contact me on: [email protected]