Gangmax Blog

Translate Shell

Translate Shell (formerly Google Translate CLI) is a command-line translator powered by Google Translate (default), Bing Translator, Yandex.Translate and Apertium. It gives you easy access to one of these translation engines in your terminal.

Installation

1
2
wget git.io/trans
chmod +x ./trans

In my Ubuntu Xenial environment, I did not install any dependencies manually. You may need do so in other environments.

How to use

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 1. Translate to your locale language:
trans vorto
# 2. Translate to a specific language:
trans :fr word
trans -t fr word
# 3. Translate to specific languages:
trans :zh+ja word
trans -t zh+ja word
# 4. Translate from a specific language:
trans zh: 手紙
trans ja: 手紙
trans -s ja 手紙
# 5. Translate more than a word:
trans en:zh "word processor"
trans :zh "To-morrow, and to-morrow, and to-morrow,"
# 6. Translate multi-line sentence:
$ trans :zh "Creeps in this petty pace from day to day,
> To the last syllable of recorded time;
> And all our yesterdays have lighted fools
> The way to dusty death."
# 7. Google Translate can be used as a dictionary. When translating
# a word and the target language is the same as the source language,
# the dictionary entry of the word is shown:
trans :en word
# 8. To enable dictionary mode no matter whether the source language and
# the target language are identical, use the -dictionary (-d) option.
trans -d fr: mot
# 9. Translate a File:
trans :zh file:///media/volume/palantir.md

More instructions can be found from the official document here.

Comments