normit (GitHub: pawurb/normit, License: MIT) package let’s you use all the Google Translate goodies in your terminal. I developed it because using web interface to translate stuff several times a day seemed way too cumbersome.

Usage

Installing it is as simple as:

npm install normit

Now translating to every language supported by the Google People is just a few keystrokes away:

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

For the lazy ones like me setting a couple of aliases makes things even easier:

alias ttp='normit en pl' # Translate To Polish
alias tte='normit pl en' # Translate To English

Looking for the synonyms of the word you are translating? Then -s flag is something for you:

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

normit can even talk to you! Just install mpg123 (check the docs for info how to) and use a -t flag:

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

Thanks to idea by Nedomas you can use normit to practice any language when doing your everyday work. After adding this hook to your ~/.zshrc file you will see and hear your git commit messages translated to the language of your choice:

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

It works only for zsh so far. I am not a shell ninja so if you come up with how to make it work for bash then don’t hesitate to submit a PR.

What’s Next?

You just came up with other cool idea on how to use normit? Then share it in the comments and I will be more then happy to include it in the docs. You can follow me on twitter to be notified about my other projects.