Translate Shell 是一个支持 Google Translate、Bing Translator、Yandex.Translate 和 Apertium 翻译引擎的命令行翻译器,默认使用的是 Google Translate 引擎,下面为大家讲解一下Linux中安装和使用Translate Shell具体方法。

如何安装 Translate Shell

有三种方法安装 Translate Shell。

  • 下载自包含的可执行文件

  • 手工安装

  • 通过包管理器安装

方法 1 : 下载自包含的可执行文件

下载自包含的可执行文件放到 /usr/bin 目录中。

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

方法 2 : 手工安装

克隆 Translate Shell 的 GitHub 仓库然后手工编译。

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

方法 3 : 通过包管理器

有些发行版的官方仓库中包含了 Translate Shell,可以通过包管理器来安装。

对于 Debian/Ubuntu, 使用 APT-GET 命令[2] 或者 APT 命令[3]来安装。

$ sudo apt-get install translate-shell

对于 Fedora, 使用 DNF 命令[4] 来安装。

$ sudo dnf install translate-shell

对于基于 Arch Linux 的系统, 使用 Yaourt 命令[5] 或 Packer 明快[6] 来从 AUR 仓库中安装。

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

如何使用 Translate Shell

安装好后,打开终端闭关输入下面命令。 谷歌翻译会自动探测源文本是哪种语言,并且在默认情况下将之翻译成你的 locale 所对应的语言。

$ trans [Words]

下面我将泰米尔语中的单词 “நன்றி” (Nanri) 翻译成英语。 这个单词的意思是感谢别人。

$ trans நன்றி
நன்றி
(Naṉṟi)ThanksDefinitions of நன்றி
[ தமிழ் -> English ]noungratitudeநன்றிthanksநன்றிநன்றிThanks

使用下面命令也能将英语翻译成泰米尔语。

$ trans :ta thanks
thanks
/THaNGks/நன்றி
(Naṉṟi)Definitions of thanks
[ English -> தமிழ் ]nounநன்றிgratitude, thanksthanksநன்றி

要将一个单词翻译到多个语种可以使用下面命令(本例中,我将单词翻译成泰米尔语以及印地语)。

$ trans :ta+hi thanks
thanks
/THaNGks/நன்றி
(Naṉṟi)Definitions of thanks
[ English -> தமிழ் ]nounநன்றிgratitude, thanksthanksநன்றிthanks
/THaNGks/धन्यवाद
(dhanyavaad)Definitions of thanks
[ English -> हिन्दी ]nounधन्यवादthanks, thank, gratitude, thankfulness, felicitationthanksधन्यवाद, शुक्रिया

使用下面命令可以将多个单词当成一个参数(句子)来进行翻译。(只需要把句子应用起来作为一个参数就行了)。

$ 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?உங்கள் வாழ்க்கையில் என்ன நடக்கிறது?

下面命令单独地翻译各个单词。

$ 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திருப்தி உடையhappyadjectiveஇன்பமானhappyhappyசந்தோஷமாக, மகிழ்ச்சி, இனிய, சந்தோஷமா

简洁模式:默认情况下,Translate Shell 尽可能多的显示翻译信息。如果你希望只显示简要信息,只需要加上 -b选项。

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

字典模式:加上 -d 可以把 Translate Shell 当成字典来用。

$ trans -d :en thanks
thanks
/THaNGks/Synonymsnoun- gratitude, appreciation, acknowledgment, recognition, creditexclamation- thank you, many thanks, thanks very much, thanks a lot, thank you kindly, much obliged, much appreciated, bless you, thanks a millionExamples- 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 alsoThanks!, thank, many thanks, thanks to, thanks to you, special thanks, give thanks, thousand thanks, Many thanks!, render thanks, heartfelt thanks, thanks to this

使用下面格式可以使用 Translate Shell 来翻译文件。

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

下面命令可以让 Translate Shell 进入交互模式。 在进入交互模式之前你需要明确指定源语言和目标语言。本例中,我将英文单词翻译成泰米尔语。

$ trans -shell en:ta thanks
Translate Shell
(:q to quit)
thanks
/THaNGks/நன்றி
(Naṉṟi)Definitions of thanks
[ English -> தமிழ் ]nounநன்றிgratitude, thanksthanksநன்றி

想知道语言代码,可以执行下面命令。

$ trans -R

或者

$ 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 │                       │
└───────────────────┴────────────────────┴────────────────────┘

想了解更多选项的内容,可以查看其 man 手册。

$ man trans

Linux中安装和使用Translate Shell相关推荐

  1. shell中竖线的作用_如何在 Linux 中安装、配置和使用 Fish Shell?

    每个 Linux 管理员都可能听到过 shell 这个词.你知道什么是 shell 吗? 你知道 shell 在 Linux 中的作用是什么吗? Linux 中有多少个 shell 可用? -- Ma ...

  2. linux fish颜色配置,如何在 Linux 中安装、配置和使用 Fish Shell?

    (给Linux爱好者加星标,提升Linux技能) 英文:Magesh Maruthamuthu,翻译:Linux中国/MK linux.cn/article-10622-1.html 每个 Linux ...

  3. ubuntu 安装yum_如何在 Linux 中安装微软的 .NET Core SDK | Linux 中国

    本分步操作指南文章解释了如何在 Linux 中安装 .NET Core SDK 以及如何使用 .NET 开发出第一个应用程序.-- Sk致谢译自 | ostechnix.com 作者 | Sk译者 | ...

  4. rust安装教程linux,如何在 Linux 中安装 Rust 编程语言

    Rust 通常被称为 rust-lang.Rust 是一个由 Mozilla Research 赞助的通用的.多范式.现代的.跨平台和开源系统编程语言. 它旨在实现安全性.速度和并发性等目标. Rus ...

  5. 鸿鹄安装-在Linux中安装

    鸿鹄是炎凰数据为广大开发者(研发人员.数据分析师.数据科学家等)提供的免费社区版一站式异构数据分析平台,包含了从异构数据的采集.导入.存储.计算分析.可视化和告警等一系列服务. 建议使用Linux系统 ...

  6. caffe-gpu ubuntu 安装_如何在Linux中安装vnStat和vnStati监视网络流量

    VnStat是针对Linux和BSD的基于控制台的网络流量监视工具设计.它将保留所选网络接口的网络流量日志.为了生成日志,vnStat使用内核提供的信息. 换句话说,它不会嗅探网络流量,并且可以确保系 ...

  7. linux mysql授权外部访问权限,Linux中安装Mysql授权远程访问

    Linux中安装MySQL 因为使用yum安装.安装过程需保证网络通畅 一.安装mysql 1.yum安装mysqlCentOS7默认数据库是mariadb,配置等用着不习惯,因此决定改成mysql, ...

  8. linux内核如何安装vim,如何在Linux 中安装和使用 PacVim?

    描述 你好,Vim用户!今天,我偶然发现了一个很酷的程序来提高 Vim 的使用技巧.Vim 是编写和编辑代码的绝佳编辑器.然而,你们中的一些人(包括我)仍在陡峭的学习曲线中挣扎.再也不用了!来看看 P ...

  9. php sftp 删除,Linux中安装,卸载ftp|sftp服务

    今天带来Linux中安装,卸载ftp|sftp服务 FTP 是File Transfer Protocol(文件传输协议)的英文简称,而中文简称为"文传协议".用于Internet ...

最新文章

  1. 二阶齐次线性微分方程的通解可以表示成两个线性无关解的线性组合
  2. linux下搭建hexo环境
  3. CDU集训代码:输入输出训练
  4. Scala关系运算符的一览图
  5. 【BZOJ4500】矩阵(差分约束)
  6. 今晚直播 | 清华大学NLP组刘正皓:神经信息检索的进展与挑战
  7. 什么是单页应用(转)
  8. linux command1
  9. 智能客户端研究笔记(三)
  10. 拳王虚拟项目公社:0成本售卖高考资料的虚拟资源教程,自动化的其他最简单最轻松玩法
  11. linux快速统计目录大小,linux下统计文件夹、文件的大小--du
  12. Python机器学习库sklearn几种分类算法建模可视化(实验)
  13. opencv 梯度幅值_20、 OpenCV导数和梯度
  14. scrapy命令介绍
  15. led伏安特性实验误差分析_为什么非线性电阻元件伏安特性曲线的误差分析?
  16. Airbnb产品运营分析报告
  17. Hadoop-HDFS详解与HA,完全分布式集群搭建(细到令人发指的教程)
  18. 美剧24中的SAP软件
  19. TOPSIS法(优劣解距离法)笔记
  20. java 线程池 简介

热门文章

  1. Recovery support touch
  2. 能源替代开辟取暖新时代 光伏赢得认可
  3. python 3d绘图 拖动_使用Matplotlib轻松搞定3D绘图
  4. [转].net开发何去何从??
  5. 2022 年度优秀开源技术
  6. 木瓜移动每日资讯0531:美的集团自研的互联网大数据产品“观星台”诞生
  7. LABVIEW编程---高级数据结构及函数(2)
  8. 问就是「AI 过」, 你认识的这 7 个 App 都支持 AI 了
  9. 用turtle画红色小汽车
  10. 商业银行智能语音识别技术-笔记