溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Linux中如何安裝和使用Translate Shell

發(fā)布時(shí)間:2022-02-17 09:56:04 來源:億速云 閱讀:131 作者:小新 欄目:開發(fā)技術(shù)

這篇文章主要介紹了Linux中如何安裝和使用Translate Shell,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

Translate Shell 是一個(gè)支持 Google Translate、Bing Translator、Yandex.Translate 和 Apertium 翻譯引擎的命令行翻譯器,默認(rèn)使用的是 Google Translate 引擎。

Linux中如何安裝和使用Translate Shell

如何安裝 Translate Shell

有三種方法安裝 Translate Shell。

  • 下載自包含的可執(zhí)行文件
  • 手工安裝
  • 通過包管理器安裝

方法 1 : 下載自包含的可執(zhí)行文件

下載自包含的可執(zhí)行文件放到 /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 : 通過包管理器

有些發(fā)行版的官方倉庫中包含了 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 的系統(tǒng), 使用 Yaourt 命令[5] 或 Packer 明快[6] 來從 AUR 倉庫中安裝。

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

如何使用 Translate Shell

安裝好后,打開終端閉關(guān)輸入下面命令。 谷歌翻譯會自動(dòng)探測源文本是哪種語言,并且在默認(rèn)情況下將之翻譯成你的 locale 所對應(yīng)的語言。

$ trans [Words]

下面我將泰米爾語中的單詞 “?????” (Nanri) 翻譯成英語。 這個(gè)單詞的意思是感謝別人。

$ trans ?????
?????
(Na??i)

Thanks

Definitions of ?????
[ ????? -> English ]

noun
   gratitude
       ?????
   thanks
       ?????

?????
   Thanks

使用下面命令也能將英語翻譯成泰米爾語。

$ trans :ta thanks
thanks
/THaNGks/

?????
(Na??i)

Definitions of thanks
[ English -> ????? ]

noun
   ?????
       gratitude, thanks

thanks
   ?????

要將一個(gè)單詞翻譯到多個(gè)語種可以使用下面命令(本例中,我將單詞翻譯成泰米爾語以及印地語)。

$ 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
   ???????, ????????

使用下面命令可以將多個(gè)單詞當(dāng)成一個(gè)參數(shù)(句子)來進(jìn)行翻譯。(只需要把句子應(yīng)用起來作為一個(gè)參數(shù)就行了)。

$ 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?
   ?????? ???????????? ???? ??????????

下面命令單獨(dú)地翻譯各個(gè)單詞。

$ 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
   ??????????, ?????????, ????, ?????????

簡潔模式:默認(rèn)情況下,Translate Shell 盡可能多的顯示翻譯信息。如果你希望只顯示簡要信息,只需要加上 -b選項(xiàng)。

$ trans -b :ta thanks
?????

字典模式:加上 -d 可以把 Translate Shell 當(dāng)成字典來用。

$ 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

使用下面格式可以使用 Translate Shell 來翻譯文件。

$ trans :ta file:///home/magi/gtrans.txt
?????? ???????????? ???? ??????????

下面命令可以讓 Translate Shell 進(jìn)入交互模式。 在進(jìn)入交互模式之前你需要明確指定源語言和目標(biāo)語言。本例中,我將英文單詞翻譯成泰米爾語。

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

?????
(Na??i)

Definitions of thanks
[ English -> ????? ]

noun
   ?????
       gratitude, thanks

thanks
   ?????

想知道語言代碼,可以執(zhí)行下面命令。

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

想了解更多選項(xiàng)的內(nèi)容,可以查看其 man 手冊。

$ man trans

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Linux中如何安裝和使用Translate Shell”這篇文章對大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI