『转载』Translate Shell – A tool to use Google translator from command line in Linux @ Magesh Maruthamuthu            分类 软件
发布于 星期三, 十一月 10 日, 2021 年
更新于 星期四, 十一月 11 日, 2021 年

原文地址

I love to work and share about CLI apps since I’m very much interested on CLI applications. Basically I prefer CLI because most of the time I will be sitting in front of the black screen and it has became habit for me to go with CLI apps instead of GUI.

We have wrote many articles about CLI applications in past. Recently I came to know about google CLI utilities such as “Google Translator”, “Google Calendar”, and “Google Contacts”. so, I just want to share about it.

Today we are going to discuss about “Google Translator” which I use many times in a day to know the meanings of many words, since my native language is Tamil.Google translate is widely used by other language speakers.

What is Translate Shell

Translate Shell (formerly known as Google Translate CLI) is a command-line translator powered by Google Translate (default), Bing Translator, Yandex.Translate and Apertium. It allows you to access to one of these translation engines right from your terminal. Translate Shell is designed to work on most of the Linux distributions.

How to install Translate Shell

We can install the Translate Shell application in three methods.

  • Download self-contained executable file
  • Manual Method
  • Via Package Manager

Method-1 : Download self-contained executable file

Just Download the self-contained executable file and move into /usr/bin directory.

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

Method-2 : Manual method

Just clone the Translate Shell github repository and compile manually for any distributions.

$ git clone https://github.com/soimort/translate-shell && cd translate-shell
$ make
$ sudo make install

Method-3 : Via package manager

Translate Shell is available in few of the distribution official repository that can be installed through package manager.

For Debian/Ubuntu, use APT-GET Command or APT Commandto install Translate Shell.

$ sudo apt-get install translate-shell

For Fedora, use DNF Command to install Translate Shell.

(adsbygoogle = window.adsbygoogle || []).push({});

$ sudo dnf install translate-shell

For Arch Linux based systems, use Yaourt Command or Packer Command to install Translate Shell from AUR repository.

$ yaourt -S translate-shell
or
$ packer -S translate-shell

How to use Translate Shell

After successfully installation, open your terminal and fire the following command. Google Translate can identify the language of the source text automatically, and Translate Shell by default translates the source text into the language of your locale.

$ trans \[Words\]

I’m going to translated a Tamil word “நன்றி” (Nanri) to English. It means “Thanks” .

$ trans நன்றி
நன்றி
(Naṉṟi)

Thanks

Definitions of நன்றி
\[ தமிழ் -> English \]

noun
    gratitude
        நன்றி
    thanks
        நன்றி

நன்றி
    Thanks

Alternatively translate a word into Tamil using following command.

$ trans :ta thanks
thanks
/THaNGks/

நன்றி
(Naṉṟi)

Definitions of thanks
\[ English -> தமிழ் \]

noun
    நன்றி
        gratitude, thanks

thanks
    நன்றி

To Translate a word into more than one language use following command (In this example, i’m going to translate a word into Tamil & Hindi).

(adsbygoogle = window.adsbygoogle || []).push({});

$ trans :ta+hi thanks
thanks
/THaNGks/

நன்றி
(Naṉṟi)

Definitions of thanks
\[ English -> தமிழ் \]

noun
    நன்றி
        gratitude, thanks

thanks
    நன்றி

thanks
/THaNGks/

धन्यवाद
(dhanyavaad)

Definitions of thanks
\[ English -> हिन्दी \]

noun
    धन्यवाद
        thanks, thank, gratitude, thankfulness, felicitation

thanks
    धन्यवाद, शुक्रिया

To Translate words into one argument (phrase) use following command (just quote the sentence into one argument).

$ trans :ta "what is going on your life?"
what is going on your life?

உங்கள் வாழ்க்கையில் என்ன நடக்கிறது?
(Uṅkaḷ vāḻkkaiyil eṉṉa naṭakkiṟatu?)

Translations of what is going on your life?
\[ English -> தமிழ் \]

what is going on your life?
    உங்கள் வாழ்க்கையில் என்ன நடக்கிறது?

To Translate Translate each word alone.

$ trans :ta curios happy
curios

ஆர்வம்
(Ārvam)

Translations of curios
\[ Română -> தமிழ் \]

curios
    ஆர்வம், அறிவாளிகள், ஆர்வமுள்ள, அறிய, ஆர்வமாக
happy
/ˈhapē/

சந்தோஷமாக
(Cantōṣamāka)

Definitions of happy
\[ English -> தமிழ் \]


    மகிழ்ச்சியான
        happy, convivial, debonair, gay
    திருப்தி உடைய
        happy

adjective
    இன்பமான
        happy

happy
    சந்தோஷமாக, மகிழ்ச்சி, இனிய, சந்தோஷமா

Brief Mode : By default, Translate Shell displays translations in a verbose manner. If you prefer to see only the brief information, just add -b option.

$ trans -b :ta thanks
நன்றி

Dictionary Mode : To use Translate Shell as a dictionary, just add -d option.

medianet_width = “728”; medianet_height = “90”; medianet_crid = “847533357”; medianet_versionId = “111299”; (function() { var isSSL = ‘https:’ == document.location.protocol; var mnSrc = (isSSL ? ‘https:’ : ‘http:') + ‘//contextual.media.net/nmedianet.js?cid=8CUF666N9’ + (isSSL ? ‘&https=1’ : ‘'); document.write('<scr’ + ‘ipt type=“text/javascript” id=“mNSC” src="’ + mnSrc + ‘"></scr’ + ‘ipt>'); })();

$ trans -d :en thanks
thanks
/THaNGks/

Synonyms
    noun
        - gratitude, appreciation, acknowledgment, recognition, credit

    exclamation
        - thank you, many thanks, thanks very much, thanks a lot, thank you kindly, much obliged, much appreciated, bless you, thanks a million

Examples
    - In short, thanks for everything that makes this city great this Thanksgiving.

    - many thanks

    - There were no thanks in the letter from him, just complaints and accusations.

    - It is a joyful celebration in which Bolivians give thanks for their freedom as a nation.

    - festivals were held to give thanks for the harvest

    - The collection, as usual, received a great response and thanks is extended to all who subscribed.

    - It would be easy to dwell on the animals that Tasmania has lost, but I prefer to give thanks for what remains.

    - thanks for being so helpful

    - It came back on about half an hour earlier than predicted, so I suppose I can give thanks for that.

    - Many thanks for the reply but as much as I tried to follow your advice, it's been a bad week.

    - To them and to those who have supported the office I extend my grateful thanks .

    - We can give thanks and words of appreciation to others for their kind deeds done to us.

    - Adam, thanks for taking time out of your very busy schedule to be with us tonight.

    - a letter of thanks

    - Thank you very much for wanting to go on reading, and thanks for your understanding.

    - Gerry has received a letter of thanks from the charity for his part in helping to raise this much needed cash.

    - So thanks for your reply to that guy who seemed to have a chip on his shoulder about it.

    - Suzanne, thanks for being so supportive with your comments on my blog.

    - She has never once acknowledged my thanks , or existence for that matter.

    - My grateful thanks go to the funders who made it possible for me to travel.

    - festivals were held to give thanks for the harvest

    - All you secretaries who made it this far into the article… thanks for your patience.

    - So, even though I don't think the photos are that good, thanks for the compliments!

    - And thanks for warning us that your secret service requires a motorcade of more than 35 cars.

    - Many thanks for your advice, which as you can see, I have passed on to our readers.

    - Tom Ryan was given a bottle of wine as a thanks for his active involvement in the twinning project.

    - Mr Hill insists he has received no recent complaints and has even been sent a letter of thanks from the forum.

    - Hundreds turned out to pay tribute to a beloved former headteacher at a memorial service to give thanks for her life.

    - Again, thanks for a well written and much deserved tribute to our good friend George.

    - I appreciate your doing so, and thanks also for the compliments about the photos!

See also
    Thanks!, thank, many thanks, thanks to, thanks to you, special thanks, give thanks, thousand thanks, Many thanks!, render thanks, heartfelt thanks, thanks to this

To Translate a File using Translate Shell, use the following format.

$ trans :ta file:///home/magi/gtrans.txt
உங்கள் வாழ்க்கையில் என்ன நடக்கிறது?

To open interactive Translate Shell, run the following command. Make sure you have to specify the source language and the target language(s) before starting an interactive shell. In this example, i’m going to translate a word from English to Tamil.

$ trans -shell en:ta thanks
Translate Shell
(:q to quit)
thanks
/THaNGks/

நன்றி
(Naṉṟi)

Definitions of thanks
\[ English -> தமிழ் \]

noun
    நன்றி
        gratitude, thanks

thanks
    நன்றி

To know the language code, just fire the following command.

$ trans -R
or
$ trans -T
┌───────────────────────┬───────────────────────┬───────────────────────┐
│ Afrikaans      -   af │ Hindi          -   hi │ Punjabi        -   pa │
│ Albanian       -   sq │ Hmong          -  hmn │ Querétaro Otomi-  otq │
│ Amharic        -   am │ Hmong Daw      -  mww │ Romanian       -   ro │
│ Arabic         -   ar │ Hungarian      -   hu │ Russian        -   ru │
│ Armenian       -   hy │ Icelandic      -   is │ Samoan         -   sm │
│ Azerbaijani    -   az │ Igbo           -   ig │ Scots Gaelic   -   gd │
│ Basque         -   eu │ Indonesian     -   id │ Serbian (Cyr...-sr-Cyrl
│ Belarusian     -   be │ Irish          -   ga │ Serbian (Latin)-sr-Latn
│ Bengali        -   bn │ Italian        -   it │ Sesotho        -   st │
│ Bosnian        -   bs │ Japanese       -   ja │ Shona          -   sn │
│ Bulgarian      -   bg │ Javanese       -   jv │ Sindhi         -   sd │
│ Cantonese      -  yue │ Kannada        -   kn │ Sinhala        -   si │
│ Catalan        -   ca │ Kazakh         -   kk │ Slovak         -   sk │
│ Cebuano        -  ceb │ Khmer          -   km │ Slovenian      -   sl │
│ Chichewa       -   ny │ Klingon        -  tlh │ Somali         -   so │
│ Chinese Simp...- zh-CN│ Klingon (pIqaD)tlh-Qaak Spanish        -   es │
│ Chinese Trad...- zh-TW│ Korean         -   ko │ Sundanese      -   su │
│ Corsican       -   co │ Kurdish        -   ku │ Swahili        -   sw │
│ Croatian       -   hr │ Kyrgyz         -   ky │ Swedish        -   sv │
│ Czech          -   cs │ Lao            -   lo │ Tahitian       -   ty │
│ Danish         -   da │ Latin          -   la │ Tajik          -   tg │
│ Dutch          -   nl │ Latvian        -   lv │ Tamil          -   ta │
│ English        -   en │ Lithuanian     -   lt │ Tatar          -   tt │
│ Esperanto      -   eo │ Luxembourgish  -   lb │ Telugu         -   te │
│ Estonian       -   et │ Macedonian     -   mk │ Thai           -   th │
│ Fijian         -   fj │ Malagasy       -   mg │ Tongan         -   to │
│ Filipino       -   tl │ Malay          -   ms │ Turkish        -   tr │
│ Finnish        -   fi │ Malayalam      -   ml │ Udmurt         -  udm │
│ French         -   fr │ Maltese        -   mt │ Ukrainian      -   uk │
│ Frisian        -   fy │ Maori          -   mi │ Urdu           -   ur │
│ Galician       -   gl │ Marathi        -   mr │ Uzbek          -   uz │
│ Georgian       -   ka │ Mongolian      -   mn │ Vietnamese     -   vi │
│ German         -   de │ Myanmar        -   my │ Welsh          -   cy │
│ Greek          -   el │ Nepali         -   ne │ Xhosa          -   xh │
│ Gujarati       -   gu │ Norwegian      -   no │ Yiddish        -   yi │
│ Haitian Creole -   ht │ Pashto         -   ps │ Yoruba         -   yo │
│ Hausa          -   ha │ Persian        -   fa │ Yucatec Maya   -  yua │
│ Hawaiian       -  haw │ Polish         -   pl │ Zulu           -   zu │
│ Hebrew         -   he │ Portuguese     -   pt │                       │
└───────────────────────┴───────────────────────┴───────────────────────┘

To know more options, navigate to man page.

$ man trans
留下昵称和邮箱, 可在第一时间获悉回复通知哦~

2021 FLAG

  • 找个妹子
  • 进计科
  • XCPC拿块金牌
  • 补全算法知识, 整全板子
  • 学会Web开发相关知识
  • 在服务器上搭建电子书库
  • 写个游戏并上线
  • 能弹一首曲子
  • 写首完整的曲子
  • 练习悠悠球

个人简介

我叫 Wings, 来自江西上饶, 目前人在西安, 是西电的一名学生.

常以 WingsWingsZengWingsWings的ID在各大小网站上游走, 一般来说, Wings不是我 😔, WingsZeng 一定是我 😊.

热爱算法, 喜欢钻研各种计算机技术.

业余爱好广泛, 只要不是文化课基本上都感兴趣😏.

开发/项目经历

  1. Android游戏 小墨滴的复仇 (弃坑)
  2. Android游戏 Circle Run (弃坑)
  3. Windows游戏 Snague (可能弃坑了吧)
  4. Python后端 Fathy' (可能弃坑了吧)

to be continued

教育经历

时间 学历 学校
2008-2014 小学 上饶市第十二小学
2014-2017 初中 上饶市第四中学
2017-2020 高中 上饶市第一中学
2020-2024 本科 西安电子科技大学
to be continued

比赛/竞赛经历

太久远太小的记不到了…

  1. 2017 国学竞赛初赛江西 没有分数或排名 二乙
  2. 2018 NOIP提高 258 省二
  3. 2019 CSP-S江西专场 145 省二
  4. 2019 数学竞赛初赛 70 没排名 (复赛打铁qaq)
  5. 2020 Gitee|Python贪吃蛇魔改大赛 可能是第四? 二等奖
  6. 2020 西电ACM训练基地熊猫杯 第四 银牌
  7. 2020 西安三校微软学生俱乐部Hackathon 和二等奖最后一名差0.5分 三等奖
  8. 2020 西电星火杯 三等奖
  9. 2020 西电ACM新生赛 第九 金牌
  10. 2020 ICPC 亚洲区域赛 济南站 132名 铜牌
  11. 2020-2021 第二届全国大学生算法设计与编程挑战赛(冬季赛) 924名 铜牌 (别骂了别骂了)
  12. 2020 ICPC 亚洲区域赛 昆明站 打星
  13. 2020 ICPC Asia-East Continent Final 签完到溜 打铁
  14. 西电"智能星"第一届自动驾驶小车比赛 第五 优胜奖|极速奖 本来可以冠军的别骂了别骂了
  15. 2021团体程序设计天体赛(CCCC) 个人二等奖
  16. 2021 西电 miniL CTF 优胜奖
  17. 2021 西电ACM校赛 第9名 金牌
  18. 2021 西电数模校赛 二等奖
  19. 2021 第15届IEEE 第48名
  20. 2021 CCPC 桂林站 打星

to be continued

爱好

技术

  • 算法
  • 独立游戏开发

游戏

  • Minecraft
  • Black Survival
  • I Wanna
  • Celeste
  • Life is Strange
  • Need for speed

运动

  • 篮球
  • 桌球
  • 乒乓球
  • 羽毛球
  • 慢跑

音乐

  • 吉他
  • 词曲
  • 流行

玩具

  • 魔方
    • 三阶速拧
    • 三阶盲拧
    • 高阶
  • yoyo球

追星

  • VAE
  • Benedict Cumberbatch