Linux Tips

How To Use Google Translate From Commandline In Linux

SEOClerks

Howdy fellow Linux customers! I simply stumbled upon this cool utility, and I couldn’t resist myself to share it with you all. Meet Translate Shell (previously often called Google Translate CLI), a command-line translator powered by common translation engines equivalent to Google Translate (default), Bing Translator, Yandex.Translate and Apertium. It lets you entry one in all these translation engines out of your terminal. Google Translate is my first most popular supply to translate English to Tamil and vice versa. Since I’m not a local English speaker, I principally rely on Google Translate for each my skilled and private use. Translate Shell utility may be very helpful and useful with regards to translate phrases from English to your native language and vice versa. It’s a cross-platform utility, so it is going to work on most trendy working techniques, together with GNU/Linux, FreeBSD, MS Home windows, and Mac OS X.

On this tutorial, we shall be discussing the way to translate a phrase, a sentence, or perhaps a webpage out of your most popular language to English and vice versa. Let’s get began!

Set up Translate Shell

Translate Shell may be put in in 3 ways.

Method1 – Utilizing Package deal supervisor

Translate Shell is on the market within the official repositories of common Linux working techniques.

On Arch Linux and derivatives:

$ sudo pacman -S translate-shell

On Debian, Ubuntu, Linux Mint:

$ sudo apt-get set up translate-shell

On Fedora:

$ sudo dnf set up translate-shell

If it isn’t obtainable within the official repositories, you’ll be able to set up it as described in any one of many following two strategies.

Method2 – Direct obtain

Obtain the self-contained executable file, make it as executable. transfer it to your $PATH and begin utilizing it.

$ wget git.io/trans
$ chmod +x trans
$ sudo mv trans /usr/native/bin/

Method3 – Set up from supply

Clone Translate Shell git repository, compile and set up it as proven beneath.

$ git clone https://github.com/soimort/translate-shell

$ cd translate-shell/

$ make
$ sudo make set up

Use Google Translate From Commandline In Linux utilizing “Translate Shell”

1. Translate a phrase/sentence

To translate a phrase, simply kind:

$ trans வணக்கம்

Pattern output:

வணக்கம்
(Vaṇakkam)

Hiya

Translations of வணக்கம்
[ தமிழ் -> English ]

வணக்கம்
Hiya, Greetings, Good, Hello, Salute

As you see within the above output, I’ve translated a Tamil phrase referred to as “வணக்கம்” (Vanakkam), which is used to greet folks, to English. By default, Translate Shell will translate the given phrases/sentences to English.

To translate a complete sentence without delay, Simply kind ‘trans’ command adopted by the sentence inside quotes like beneath.

$ trans “எப்படி இருக்கீங்க?”

Pattern output:

எப்படி இருக்கீங்க?
(Eppaṭi irukkīṅka?)

How are you?

Translations of எப்படி இருக்கீங்க?
[ தமிழ் -> English ]

எப்படி இருக்கீங்க?
How are you?

As you see within the above instance, Translate Shell provides you the detailed translation of the given sentence.

When translating a sentence, put them inside quotes. If you happen to don’t put them contained in the quotes, every phrase within the sentence shall be translated alone like beneath.

$ trans எப்படி இருக்கீங்க?
எப்படி null
(null Eppaṭi)

How null
/null null/

Definitions of எப்படி null
[ தமிழ் -> English ]

adverb
how
எப்படி
இருக்கீங்க? null
(null Irukkīṅka?)

Are you? null
/null null/

Translations of இருக்கீங்க? null
[ தமிழ் -> English ]

இருக்கீங்க ?
Are you?

To get the transient translation of the given sentence, kind the sentence with -brief parameter as proven beneath.

$ trans -brief “எப்படி இருக்கீங்க?”

The pattern output can be:

How are you?

This above command will simply show the precise translation.

2. Translate the contents of a file

I need to translate a complete textual content file to English, is it doable? Sure you’ll be able to!

Allow us to see the contents of textual content file

$ cat greet.txt

Here’s what I’ve within the textual content file.

வணக்கம். எப்படி இருக்கீங்க?

To translate this textual content file, simply kind:

$ trans file:///dwelling/sk/greet.txt

Pattern output:

Hiya. How are you?

Cool isn’t it?

Three. Discover language codes

As you already know already, Google translate helps over 100 languages. So it is very important know the language codes to translate sentences to different languages.

To show the language codes, kind:

$ trans -R

Pattern output:

translate shell 1

Language codes

Simply choose any language of your alternative and translate the sentence immediately. You don’t want an online browser. Every little thing shall be displayed proper out of your Terminal.

four. Translate to a number of languages

As you observed, all of the translations that we’ve got accomplished to date are from different languages (Tamil in my case) to English. If you wish to change the goal language, kind :(colon) adopted by particular language code.

Say for instance, to translate a phrase to Hindi, simply kind:

$ trans :hello வணக்கம்

This command will translate the Tamil phrase “வணக்கம்” to Hindi language.

Pattern output:

வணக்கம்
(Vaṇakkam)

नमस्ते
(namaste)

Translations of வணக்கம்
[ தமிழ் -> हिन्दी ]

வணக்கம்
नमस्ते, करें Hiya, नमस्कार, Hiya

We will additionally translate phrases to a number of languages in a single go. To take action, use use a plus signal “+” because the delimiter. For example, the next command will translate the given phrase to Hindi and Telugu.

$ trans :hello+te வணக்கம்
வணக்கம் null
(null Vaṇakkam)

नमस्ते null
(null namaste)

Translations of வணக்கம் null
[ தமிழ் -> हिन्दी ]

வணக்கம்
नमस्ते, को नमस्कार, Hiya, नमस्कार

வணக்கம் null
(null Vaṇakkam)

హలో null
(null Halō)

Translations of வணக்கம் null
[ தமிழ் -> తెలుగు ]

வணக்கம்
హలో, h- ఇ- llo, కిట్టి, కు హలో

Alternatively, you need to use -t possibility (as an alternative of colon) to specify the goal language(s). This command interprets the given phrase to Hindi, Telugu and Kannada.

$ trans -t hello+te+kn வணக்கம்

To translate a sentence to a number of languages, quote the sentence like one argument as proven beneath.

$ trans :hello+te+kn “எப்படி இருக்கீங்க?”
எப்படி இருக்கீங்க? null
(null Eppaṭi irukkīṅka?)

आप कैसे हैं null
(null aap kaise hain)

Translations of எப்படி இருக்கீங்க? null
[ தமிழ் -> हिन्दी ]

எப்படி இருக்கீங்க?
आप कैसे हैं, आप कैसे हैं?

எப்படி இருக்கீங்க? null
(null Eppaṭi irukkīṅka?)

మీరు ఎలా ఉన్నారు null
(null Mīru elā unnāru)

Translations of எப்படி இருக்கீங்க? null
[ தமிழ் -> తెలుగు ]

எப்படி இருக்கீங்க?
మీరు ఎలా ఉన్నారు, మీరు ఎలా ఉన్నారు?

எப்படி இருக்கீங்க? null
(null Eppaṭi irukkīṅka?)

ನೀನು ಹೇಗೆ? null
(null Nīnu hēge?)

Translations of எப்படி இருக்கீங்க? null
[ தமிழ் -> ಕನ್ನಡ ]

எப்படி இருக்கீங்க?
ನೀನು ಹೇಗೆ?, ಹೇಗಿರುವಿರಿ?

Or, use -t possibility.

$ trans -t hello+te+kn “எப்படி இருக்கீங்க?”

5. Translate from a selected language

Generally, Google translate could wrongly establish the supply textual content as another language than you anticipated. In such instances, it’s worthwhile to specify the supply language explicitly like beneath.

$ trans ta: வணக்கம்
வணக்கம் null
(null Vaṇakkam)

Hiya null
/null null/

Translations of வணக்கம் null
[ தமிழ் -> English ]

வணக்கம்
Hiya, Greetings, Good, Hello, Salute

Please thoughts that you need to put the colon after the language code, not earlier than. If you happen to put the colon earlier than language, it is going to be acknowledged as goal language.

Alternatively, simply use -s possibility (as an alternative of colon) to specify the supply language as proven beneath.

$ trans -s ta வணக்கம்

6. Interactive Translation

Translate Shell can be used as interactive translator. Meaning you’ll be able to translate line by line interactively.

To take action, use -shell possibility like beneath.

$ trans -shell -brief
Translate Shell
(:q to stop)
> வணக்கம்
Hiya null
> எப்படி இருக்கீங்க?
How are you? null
>

Press Ctrl+c to stop the interactive translation.

7. Translate an internet site

What about translating an internet site? That’s additionally doable.

$ trans https://www.ostechnix.com/

This command will open a brand new browser window and translate the web site into English. Because the above web site is already in English, It simply displayed:

The web page you’ve gotten tried to translate is already in English.

To translate ostechnix.com website to another language, for instance Tamil, simply kind:

$ trans :ta https://www.ostechnix.com/
translate shell 2

Translate an internet site from command line

eight. Dictionary mode

Google translate can be used as a dictionary. To know the that means of a given phrase, run:

$ trans :en வணக்கம்
வணக்கம் null
(null Vaṇakkam)

Hiya null
/null null/

Translations of வணக்கம் null
[ தமிழ் -> English ]

வணக்கம்
Hiya, Greetings, Good, Hello, Salute

To allow dictionary mode irrespective of whether or not the supply language and the goal language are an identical, use the -d possibility like beneath.

$ trans -d te: வணக்கம்

9. Language identification

To establish the language of a given textual content, use -id possibility.

$ trans -id வணக்கம்
தமிழ்
Identify Tamil
Household Dravidian
Writing system Tamil
Code ta
ISO 639-Three tam
SIL http://www-01.sil.org/iso639-Three/documentation.asp?id=tam
Glottolog http://glottolog.org/useful resource/languoid/id/tami1289
Wikipedia http://en.wikipedia.org/wiki/Tamil_language

As you’ll be able to see within the above output, I’ve used Tamil language.

10. Textual content-to-Speech

This one other cool factor that I appreciated in Translate Shell. Similar to the Google translate internet service, we are able to take heed to the interpretation and unique textual content. Put your headphone on and sort the language of your option to hear.

To take heed to the interpretation, run:

$ trans -b -p :ta வணக்கம்

To take heed to the unique textual content, run:

$ trans -sp “எப்படி இருக்கீங்க?”

11. Terminal paging

Generally, the contents of translation may be an excessive amount of for show in a single display. In such instances, use -v choice to show the interpretation consequence web page by web page.

$ trans -d -v phrase

12. Getting assist

To show assist part, run:

$ trans –help

To show Translate shell man web page:

$ trans -M

Observe: Right here M is capital letter.

And, that’s all for now. You understand how to make use of Google translate from command line on Unix-like techniques. As you’ll be able to see, utilizing Google translate service from command line is simple, sort of enjoyable and attention-grabbing.

Extra good stuffs to return. Keep tuned!

Cheers!

Useful resource: 

Thanks for stopping by!

Assist us that will help you:

Have a Good day!!

Source link

Related Articles

Back to top button