Code Monkey home page Code Monkey logo

termit's Introduction

Termit Build Status Gem Version Coverage Status

Termit is an easy way to translate stuff in your terminal. You can check out its node.js npm version normit.

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?"

Quotation marks 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 (requires mpg123):

termit en fr "hey cowboy where is your horse?" -t
=> "Hey cowboy où est votre cheval ?" # and a french voice says something about a horse

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

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

Learning language when committing to git

Idea by Nedomas. See and hear your messages translated to target lang every time you commit. You can do this two ways: overriding the git command, and using a post-commit hook in git.

Override the git command (zsh only)

In ~/.zshrc

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

I am no shell ninja so if you know how to make it work in bash then please submit a PR.

Using a post-commit hook

Add a file named post-commit to your project's .git/hooks directory, with this in it:

termit en es "`git log -1 --pretty=format:'%s'`" -t

Remember to switch the languages according to your preference.

If you want this to be in every one of your git repositories, see this Stack Overflow answer.

Language codes:

To find all available language codes visit https://msdn.microsoft.com/en-us/library/hh456380.aspx

Requirements

Works with Ruby 1.9.2 and higher.

To use speech synthesis you need to have mpg123 installed.

For Ubuntu:

sudo apt-get install mpg123

For MacOSX:

brew install mpg123

Status

It was rewritten to work with Bing Translator . Thanks to Ragnarson for supporting it !

Disclaimer

Termit works by scraping the private APIs and is therefore not recommended for use in production or on a large scale.

termit's People

Contributors

blakejakopovic avatar brandonsturgeon avatar chadoh avatar kotp avatar markets avatar n10v avatar pawurb avatar ysksn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.