normit

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:

1
npm install normit

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

1
2
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:

1
2
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:

1
2
3
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:

1
2
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:

1
2
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.

Post navigation

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *