Translations with speech synthesis in your terminal as a node package

Overview

Normit Build Status NPM version Coverage Status

Normit is an easy way to translate stuff in your terminal. You can 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 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 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

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 $@}

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

Language codes:

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

Requirements

Works with node 0.10.0 and higher.

To use speech synthesis you need to have mpg123 installed.

For Ubuntu:

sudo apt-get install mpg123

For MacOSX:

brew install mpg123

For Windows: Download Site or Direct Download mpg123-1.24.0-x86-64.zip

Status

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

Disclaimer

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

Comments
  • For Windows Too

    For Windows Too

    Your code worked like a charm for me.... Just fixed Os which/where issue.

    (And added windows install not for mpg123)

    Respect to the Author - Loved your code

    Lief. https://www.npmjs.com/package/liefs-layout-manager

    opened by electriclief 14
  • Normit broken?

    Normit broken?

    Hi,

    I don't know javascript therefore I am not able to ascertain the source/nature of the problem. But normit seems to have stopped translating. All I get is 'There seems to be a problem with your internet connection'. I have tried it from two different places. Got the same response.

    Could you please look into it?

    Thanks a lot for the library! I am using it in an IOT project.

    opened by abinash111 4
  • Future maintenance - merge with attranslate?

    Future maintenance - merge with attranslate?

    Hi,

    I really like the simple usage of normit and I believe that CLI-translation tools are still underrated. But since normit is not maintained anymore, I wrote the new tool attranslate that does a similar thing as normit: https://github.com/fkirc/attranslate

    However, there is still a caveat. attranslate is designed to translate entire apps or websites instead of CLI texts. In theory, it would be be trivial to extend attranslate to translate CLI texts. In practice, however, it is necessary to configure an API-key before using attranslate. Configuring such an API-key is easy for any serious app or website, but it is tedious if you want to install and run attranslate just for a one-off task. So my question is:

    Are you aware of any high-quality translation service that works without any API-key? Scraping Google Translate or Bing might be doable, but I am not sure whether this is stable or against their terms of service? If this is doable, then it might be easy to adopt normit-functionality for attranslate.

    opened by fkirc 1
  • Have APIs changed again?

    Have APIs changed again?

    This issue affects both termit and normit.

    In normit, I get the following behavior:

    $  normit en es hello
    NORMIT: There seems to be a problem with your internet connection
    

    In termit, I get the following behavior:

    $  termit en es hello
    /usr/lib/ruby/gems/2.3.0/gems/termit-2.13.0/lib/termit/text_response_handler.rb:22:in `extract_translation': undefined method `split' for nil:NilClass (NoMethodError)
            from /usr/lib/ruby/gems/2.3.0/gems/termit-2.13.0/lib/termit/text_response_handler.rb:13:in `call'
            from /usr/lib/ruby/gems/2.3.0/gems/termit-2.13.0/lib/termit/text_translator.rb:13:in `call'
            from /usr/lib/ruby/gems/2.3.0/gems/termit-2.13.0/lib/termit/main.rb:10:in `translate'
            from /usr/lib/ruby/gems/2.3.0/gems/termit-2.13.0/bin/termit:10:in `<top (required)>'
            from /usr/bin/termit:23:in `load'
            from /usr/bin/termit:23:in `<main>'
    
    opened by enkiv2 1
  • The Unix Way™

    The Unix Way™

    Would be awesome if normit could accept text from stdin so you could do: normit en es < myfile.txt or even webtorrent "magnet_link_to_book" --stdout | normit en es -t to torrent a book and have it translated and read to you live!

    opened by feross 1
Releases(1.0.3)
Owner
Paweł Urbanek
Software developer
Paweł Urbanek
Terminal ui for discord with interactive terminal

dickord why No fucking clue i was bored or something. why does it look dogshit Try and find a node module that supports terminal functions like trauma

Hima 3 Nov 7, 2022
Terminal recorder: Record your termial session into HTML

terminal-recorder Terminal recorder allows you to record your bash session, and export it to html so then you can share it with your friends. GitHub P

Cristian Cortez 104 Mar 3, 2022
📜 Create mutable log lines into the terminal, and give life to your logs!

Because Logging can be pretty and fun Installation $ npm install draftlog What it does It allows you to re-write a line of your log after being writt

Ivan Seidel 1.2k Dec 31, 2022
Add a hungry turtle to your terminal and feed it every time you mistype 'npm' as 'nom'

Nom Does this ever happen to you? You happily code away on a project, navigating the command line like a pro, testing, error logging, installing packa

Meike Hankewicz 5 Apr 26, 2022
DataENV is a cli tool that allows you to save data temporarily using your terminal.

DataEnv CLI Instllation npm install -g dataenv Usage Table of Contents LocalStorage npx dataenv save Parameters npx dataenv show Parameters npx dataen

PGamerX 2 Feb 5, 2022
:eyeglasses: Node.js module that tells you when your package npm dependencies are out of date.

Node.js module that tells you when your package npm dependencies are out of date. Getting Started Install Node.js. Install david: cd /your/project/dir

Alan Shaw 953 Dec 25, 2022
Sublime-like terminal-based text editor

slap ?? slap is a Sublime-like terminal-based text editor that strives to make editing from the terminal easier. It has: first-class mouse support (ev

slap 6.1k Jan 1, 2023
A terminal-to-gif recorder minus the headaches.

ttystudio A terminal-to-gif recorder minus the headaches. Record your terminal and compile it to a GIF or APNG without any external dependencies, bash

Christopher Jeffrey (JJ) 3.2k Dec 23, 2022
rtail(1) - Terminal output to the browser in seconds, using UNIX pipes.

rtail(1) Terminal output to the browser in seconds, using UNIX pipes. rtail is a command line utility that grabs every line in stdin and broadcasts it

Kilian Ciuffolo 1.6k Jan 6, 2023
Pipeable javascript. Quickly filter, map, and reduce from the terminal

Pipeable JavaScript - another utility like sed/awk/wc... but with JS! Quickly filter, map and reduce from the command line. Features a streaming API.

Daniel St. Jules 410 Dec 10, 2022
Terminal task list

listr Terminal task list Install $ npm install --save listr Usage const execa = require('execa'); const Listr = require('listr'); const tasks = new

Sam Verschueren 3.1k Jan 3, 2023
Display images in the terminal

terminal-image Display images in the terminal Works in any terminal that supports colors. In iTerm, the image will be displayed in full resolution, si

Sindre Sorhus 905 Dec 25, 2022
:rainbow: Beautiful color gradients in terminal output

gradient-string Beautiful color gradients in terminal output Install $ npm i gradient-string Usage const gradient = require('gradient-string'); cons

Boris K 864 Jan 3, 2023
Create clickable links in the terminal

terminal-link Create clickable links in the terminal Install $ npm install terminal-link Usage import terminalLink from 'terminal-link'; const link

Sindre Sorhus 539 Dec 31, 2022
Reliably get the terminal window size

term-size Reliably get the terminal window size Because process.stdout.columns doesn't exist when run non-interactively, for example, in a child proce

Sindre Sorhus 132 Oct 11, 2022
Truncate a string to a specific width in the terminal

cli-truncate Truncate a string to a specific width in the terminal Gracefully handles ANSI escapes. Like a string styled with chalk. It also supports

Sindre Sorhus 78 Oct 10, 2022
Execute shell commands in terminal

Execute shell commands in terminal

skanehira 9 Dec 11, 2021
Just a minimal library to do some terminal stuff.

Termctl A simple library to do some basic terminal stuff. Usage const termctl = require("termctl"); Note: We have tested this on Linux Mint and Window

Biraj 4 Sep 28, 2021