Skip to content

Latest commit

 

History

History
96 lines (65 loc) · 2.27 KB

README.md

File metadata and controls

96 lines (65 loc) · 2.27 KB

#Normit Build Status NPM version

Normit is an easy way to use Google Translate in your terminal. Check out its ruby gem version termit

Installation

npm install normit -g

Usage

normit 'source_language' 'target_language' 'text'

Example:

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

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

Parenthesis are not necessary for text data input:

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

Speech synthesis

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

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

You can use normit as a speech synthesizer of any supported language without having to translate anything:

normit en en "hold your horses cowboy !" -t
=> "hold your horses cowboy !" # and an english voice asks you to hold on

Synonyms

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

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

Learning language when committing to git (zsh only)

Idea by Nedomas . See and hear your messages translated to target lang every time you commit:

In ~/.zshrc

export LANG=es
git(){[[ "$@" = commit\ -m* ]]&&normit en $LANG ${${@:$#}//./} -t;command git $@}

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

To use speech synthesis you need to have mpg123 installed.

For Ubuntu:

sudo apt-get install mpg123

For MacOSX:

brew install mpg123

Status

This my first node project. All code quality regarding PRs are more than welcome :)