GithubHelp home page GithubHelp logo

anoncheg1 / command-line-translator Goto Github PK

View Code? Open in Web Editor NEW
26.0 2.0 4.0 292 KB

Command-line access to google translate and some other features

License: GNU General Public License v3.0

Shell 56.18% Perl 43.82%
google-translate urban-dictionary language-detection language-translation command-line

command-line-translator's Introduction

Gitter chat

Google translate script. It gives you easy access to Google Translate in your terminal:

Installation step by step:

    1. download one of the version Perl (perlfork.pl) or Bash (translate and urban.pl)
    1. install requirements
    1. execute command: $ chmod +x perlfork.pl translate urban.pl
    1. add to ~/.bash_aliases: alias t="/home/user/perlfork.pl"
    1. (optional) edit options section in script perlfork.pl or translate for your taste (choose language detection scema)
$ t die unbekannten Sprache
	Language: German
	...
$ t -l
	de	German
$ alias tde="t -s de -t en"
$ tde "die unbekannten Sprache"
	the unknown language

https://github.com/Anoncheg1/Command-line-translator

Google translate shell, Google translate command-line, command-line translator Google Translate, Linux, easy to use, fast and comfortable. Command-line google translate, quick translate, very simple scripts, scripts for assess Google Translate, Google Translate CLI.

FILES:

  • perlfork.pl - Perl5 version. Google translate only.
  • translate - Bash version. Good for English dictionary.
  • urban.pl - optional plugin for bash version.

Perl version

get perl version:

$ wget http://git.io/vEUKU
$ chmod +x perlfork.pl

REQUIREMENTS:

  • perl5 >= v5.16
  • perl JSON
  • perl Clone
  • perl LWP::Protocol::socks -if you need socks proxy
  • mplayer or mpg123 -for sound

FEATURES:

  • Windows support(planned),
  • translated text,
  • fixed text with highlight,
  • language detection,
  • dictionary,
  • translit,
  • google text-to-speach

There is two systems for detection of direction($FIRST_LANG to $SECOND_LANG or vice versa):

  • Simple detection of direction. First it search Latin or Russian symbols and decide. If not found it use $source = 'auto'; $target = 'en';
  • Advanced detection of direction. ALD=1;

Bash version - extended support for english and german, urban dictionary

REQUIREMENTS:

  • UTF-8 support for required languages
  • curl >= 7.21.0
  • SpiderMonkey or nodejs
  • mpg123 for playing pronunciation For Debian sid: #apt-get install curl spidermonkey-bin html2text mpg123 For Debian jessie: #apt-get install curl nodejs html2text mpg123 For FreeBSD: #pkg install curl spidermonkey24 html2text mpg123
  • forvo.com account for pronunciation
  • optional: urban.pl, perl HTML-Tree (see URBAN_DICTIONARY)

FEATURES:

  • translated text,
  • fixed text with highlight,
  • language detection,
  • dictionary,
  • translit,
  • execution without parameters will translate fixed string for 1-2 words
  • prompt mode
  • requery with fixed

for english:

  • phrases, forms, ideom, transcription, audio pronunciation
  • cache for words
  • saving english words to file for learning
  • urban dictionary

for german:

  • transcription

for convenience. Add to ~/.bash_aliases:

  • alias t="/home/user/perlfork.pl"
  • alias ts="/home/user/translate -S"

Commands:

  • -s Source language (can be "auto")
  • -t Target language (can't be)
  • -l List of languages
  • -h Help

Examples:

  • t -s auto -t en 母亲
  • cat file | t -

Debian Cyrillic support in tty shell:

    1. #dpkg-reconfigure locales
  • Install en_US.utf8, ru_RU.utf8
    1. #dpkg-reconfigure console-setup
  • Install . Combined - latin slavic Cyrillic; Greek

command line google translate command-line translator linux debian gentoo fedora mint ubuntu text-based languages

command-line-translator's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

command-line-translator's Issues

problem with tmpjsobj

eab@kairos:~/git/dotemacs$ translate word
sed: невозможно прочитать tmpjsobj: Нет такого файла или каталога

/home/eab/.config/translate/tmpjsobj2:56
print('Detected language: '+arr[8][0][0]); //detected language
^
ReferenceError: print is not defined
at language_identification (/home/eab/.config/translate/tmpjsobj2:56:3)
at Object. (/home/eab/.config/translate/tmpjsobj2:59:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
.....

eab@kairos:/git/dotemacs$ nodejs --version
v0.10.37
eab@kairos:
/git/dotemacs$ curl --version
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
eab@kairos:~/git/dotemacs$ html2text -version
This is html2text, version 1.3.2a

eab@kairos:~/git/dotemacs$ locale -a
C
C.UTF-8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
POSIX
ru_RU.cp1251
ru_RU.utf8
ru_UA.utf8

https://dl.dropboxusercontent.com/u/1897885/tmpjsobj2
https://dl.dropboxusercontent.com/u/1897885/tmpjsobj

TKK google games

It seems API changed.
Some people says TK is changed.
Let's hack again.

js: command not found

$ translate -s es -t en "Taller de ventas "El arte de negociar y persuadir", 21 octubre"
/usr/local/bin/translate: line 440: js: command not found
/usr/local/bin/translate: line 443: js: command not found
/usr/local/bin/translate: line 446: js: command not found
/usr/local/bin/translate: line 449: js: command not found
trying with detected language
[repeat]

What am I missing here?

Errors in translation text

Everything is being translated with wrong text:

$ tran curious
;N1>?KB=K9
8<O ?@8;030B5;L=>5
;N1>?KB=K9 curious,nosy,pry,newsy,nosey 3350
AB@0==K9 Strange,weird,odd,bizarre,peculiar,curious 30
;N1>7=0B5;L=K9 curious,inquisitive,inquiring 30
:C@L57=K9 curious 20
?KB;82K9 inquisitive,inquiring,curious,prying,inquisitorial 9.6
2>71C640NI89 ;N1>?KBAB2> curious 0.8
M@>B8G5A:89 erotic,sexy,erogenous,curious 0.3
?>@=>3@0D8G5A:89 pornographic,porno,blue,curious,X-rated 0.2
EXAMPLES:
1 curious about: . Children are curious about animals and how they live.
1 curious to see/hear/know something: . People were curious to know why the accident happened.
1 a curious look/glance: . She shot him a quick, curious look.
2 it is curious that: . It is rather curious that you've never mentioned this before.
['kjuərɪəs]
http://oxforddictionaries.com/definition/english/curious

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.