• This repository has been archived on 18/May/2023
  • Stars
    star
    507
  • Rank 87,068 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Translations with speech synthesis in your terminal as a ruby gem

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.

More Repositories

1

rails-pg-extras

Rails PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Ruby
1,128
star
2

ecto_psql_extras

Ecto PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Elixir
359
star
3

rails-brotli-cache

Drop-in enhancement for Rails cache, offering better performance and compression with Brotli algorithm
Ruby
250
star
4

normit

Translations with speech synthesis in your terminal as a node package
JavaScript
240
star
5

activerecord-analyze

Add EXPLAIN ANALYZE to Rails Active Record query objects
Ruby
217
star
6

smart_init

A simple gem for eliminating Ruby initializers boilerplate code, and providing unified service objects API
Ruby
179
star
7

ruby-pg-extras

Ruby PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Ruby
127
star
8

node-postgres-extras

NodeJS PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
JavaScript
71
star
9

univ3-revm-arbitrage

Uniswap V3 MEV arbitrage calculations with REVM
Rust
50
star
10

pg-locks-monitor

A simple tool to observe PostgreSQL database locks in Rails apps.
Ruby
50
star
11

devloop

An automated test runner for Rails that instantly executes specs based on a recent git diff output.
Ruby
41
star
12

ecto_extras

Ecto helper functions.
Elixir
38
star
13

lazyme

A simple gem to help you optimize your shell workflow
Ruby
37
star
14

python-pg-extras

Python PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Python
34
star
15

Locker

Ethereum Smart Contracts for locking Ether, ERC20 and ERC721 tokens based on time and price conditions
TypeScript
31
star
16

WaitForIt

Events and time based iOS app scenarios made easy.
Swift
26
star
17

.dotfiles

My development environment settings.
Shell
13
star
18

haskell-pg-extras

Haskell PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Haskell
9
star
19

ruby-jemalloc-node-yarn

Docker image of Ruby with Jemalloc Node 16 LTS and Yarn
Dockerfile
9
star
20

railsSearchKit

This Chrome extension provides easy access to the search bars every Rails developer needs.
JavaScript
8
star
21

mev-gas-optimization

Optimize MEV Arbitrage Smart Contract with Yul and Huff
Rust
7
star
22

dont_you_count

Disable count queries for selected Active Admin tables.
Ruby
7
star
23

pi-hole-docker-compose

pi-hole-docker-compose
7
star
24

rust-pg-extras

Rust PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Rust
6
star
25

activerecord-implicit-order

Ruby
5
star
26

delegate_it

A drop in replacement for ActiveSupport delegate method in non Rails projects.
Ruby
4
star
27

active-admin-tips

Active Admin tips and performance optimizations in action
Ruby
4
star
28

Siorbackend

Ruby
1
star
29

FRP_introduction

Comparison between observer and reactive approach to login form validations.
JavaScript
1
star
30

focus.apki.io

Landing page for Focus app
HTML
1
star
31

abstract_base

Abstract Class pattern Ruby gem
Ruby
1
star