自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Translate Shell :一款在Linux命令行中使用谷歌翻譯的工具

系統(tǒng) Linux
我寫過很多關(guān)于 CLI 應(yīng)用的文章。 最近我發(fā)現(xiàn)了一些谷歌的 CLI 工具,像 “Google Translator”、“Google Calendar” 和 “Google Contacts”。 這里,我想在給大家分享一下。

[[212152]]

我對 CLI 應(yīng)用非常感興趣,因此熱衷于使用并分享 CLI 應(yīng)用。 我之所以更喜歡 CLI 很大原因是因?yàn)槲以诖蠖鄶?shù)的時候都使用的是字符界面(black screen),已經(jīng)習(xí)慣了使用 CLI 應(yīng)用而不是 GUI 應(yīng)用。

我寫過很多關(guān)于 CLI 應(yīng)用的文章。 最近我發(fā)現(xiàn)了一些谷歌的 CLI 工具,像 “Google Translator”、“Google Calendar” 和 “Google Contacts”。 這里,我想在給大家分享一下。

今天我們要介紹的是 “Google Translator” 工具。 由于我的母語是泰米爾語,我在一天內(nèi)用了很多次才理解了它的意義。

谷歌翻譯為其它語系的人們所廣泛使用。

什么是 Translate Shell

Translate Shell (之前叫做 Google Translate CLI) 是一款借助谷歌翻譯(默認(rèn))、必應(yīng)翻譯、Yandex.Translate 以及 Apertium 來翻譯的命令行翻譯器。它讓你可以在終端訪問這些翻譯引擎。 Translate Shell 在大多數(shù) Linux 發(fā)行版中都能使用。

如何安裝 Translate Shell

有三種方法安裝 Translate Shell。

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

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

下載自包含的可執(zhí)行文件放到 /usr/bin 目錄中。

  1. $ wget git.io/trans 
  2.  
  3. $ chmod +x ./trans 
  4.  
  5. $ sudo mv trans /usr/bin/ 

方法 2 : 手工安裝

克隆 Translate Shell 的 GitHub 倉庫然后手工編譯。

  1. $ git clone https://github.com/soimort/translate-shell && cd translate-shell 
  2.  
  3. $ make 
  4.  
  5. $ sudo make install 

方法 3 : 通過包管理器

有些發(fā)行版的官方倉庫中包含了 Translate Shell,可以通過包管理器來安裝。

對于 Debian/Ubuntu, 使用 APT-GET 命令 或者 APT 命令來安裝。

  1. $ sudo apt-get install translate-shell 

對于 Fedora, 使用 DNF 命令 來安裝。

  1. $ sudo dnf install translate-shell 

對于基于 Arch Linux 的系統(tǒng), 使用 Yaourt 命令 或 Packer 明快 來從 AUR 倉庫中安裝。

  1. $ yaourt -S translate-shell 
  2.  
  3. or 
  4.  
  5. $ packer -S translate-shell 

如何使用 Translate Shell

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

  1. $ trans [Words] 

下面我將泰米爾語中的單詞 “நன்றி” (Nanri) 翻譯成英語。 這個單詞的意思是感謝別人。   

  1. $ trans நன்றி 
  2. நன்றி 
  3. (Naṉṟi) 
  4. Thanks 
  5. Definitions of நன்றி 
  6. [ தமிழ் -> English ] 
  7. noun 
  8.     gratitude 
  9.         நன்றி 
  10.     thanks 
  11.         நன்றி 
  12. நன்றி 
  13.     Thanks 

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

  1. $ trans :ta thanks 
  2. thanks 
  3. /THaNGks/ 
  4. நன்றி 
  5. (Naṉṟi) 
  6. Definitions of thanks 
  7. [ English -> தமிழ் ] 
  8. noun 
  9.     நன்றி 
  10.         gratitude, thanks 
  11. thanks 
  12.     நன்றி 

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

  1. $ trans :ta+hi thanks 
  2. thanks 
  3. /THaNGks/ 
  4. நன்றி 
  5. (Naṉṟi) 
  6. Definitions of thanks 
  7. [ English -> தமிழ் ] 
  8. noun 
  9.     நன்றி 
  10.         gratitude, thanks 
  11. thanks 
  12.     நன்றி 
  13. thanks 
  14. /THaNGks/ 
  15. धन्यवाद 
  16. (dhanyavaad) 
  17. Definitions of thanks 
  18. [ English -> हिन्दी ] 
  19. noun 
  20.     धन्यवाद 
  21.         thanks, thank, gratitude, thankfulness, felicitation 
  22. thanks 
  23.     धन्यवाद, शुक्रिया 

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

  1. $ trans :ta "what is going on your life?" 
  2. what is going on your life? 
  3. உங்கள் வாழ்க்கையில் என்ன நடக்கிறது? 
  4. (Uṅkaḷ vāḻkkaiyil eṉṉa naṭakkiṟatu?) 
  5. Translations of what is going on your life? 
  6. [ English -> தமிழ் ] 
  7. what is going on your life? 
  8.     உங்கள் வாழ்க்கையில் என்ன நடக்கிறது? 

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

  1. $ trans :ta curios happy 
  2. curios 
  3. ஆர்வம் 
  4. (ārvam) 
  5. Translations of curios 
  6. [ Română -> தமிழ் ] 
  7. curios 
  8.     ஆர்வம், அறிவாளிகள், ஆர்வமுள்ள, அறிய, ஆர்வமாக 
  9. happy 
  10. /ˈhapē/ 
  11. சந்தோஷமாக 
  12. (Cantōṣamāka) 
  13. Definitions of happy 
  14. [ English -> தமிழ் ] 
  15.     மகிழ்ச்சியான 
  16.         happy, convivial, debonair, gay 
  17.     திருப்தி உடைய 
  18.         happy 
  19. adjective 
  20.     இன்பமான 
  21.         happy 
  22. happy 
  23.     சந்தோஷமாக, மகிழ்ச்சி, இனிய, சந்தோஷமா 

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

  1. $ trans -b :ta thanks 
  2.  
  3. நன்றி 

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

  1. $ trans -d :en thanks 
  2. thanks 
  3. /THaNGks/ 
  4. Synonyms 
  5.     noun 
  6.         - gratitude, appreciation, acknowledgment, recognition, credit 
  7.     exclamation 
  8.         - thank you, many thanks, thanks very much, thanks a lot, thank you kindly, much obliged, much appreciated, bless you, thanks a million 
  9. Examples 
  10.     - In short, thanks for everything that makes this city great this Thanksgiving. 
  11.     - many thanks 
  12.     - There were no thanks in the letter from him, just complaints and accusations. 
  13.     - It is a joyful celebration in which Bolivians give thanks for their freedom as a nation. 
  14.     - festivals were held to give thanks for the harvest 
  15.     - The collection, as usual, received a great response and thanks is extended to all who subscribed. 
  16.     - It would be easy to dwell on the animals that Tasmania has lost, but I prefer to give thanks for what remains. 
  17.     - thanks for being so helpful 
  18.     - It came back on about half an hour earlier than predicted, so I suppose I can give thanks for that. 
  19.     - Many thanks for the reply but as much as I tried to follow your advice, it's been a bad week. 
  20.     - To them and to those who have supported the office I extend my grateful thanks . 
  21.     - We can give thanks and words of appreciation to others for their kind deeds done to us. 
  22.     - Adam, thanks for taking time out of your very busy schedule to be with us tonight. 
  23.     - a letter of thanks 
  24.     - Thank you very much for wanting to go on reading, and thanks for your understanding. 
  25.     - Gerry has received a letter of thanks from the charity for his part in helping to raise this much needed cash. 
  26.     - So thanks for your reply to that guy who seemed to have a chip on his shoulder about it. 
  27.     - Suzanne, thanks for being so supportive with your comments on my blog. 
  28.     - She has never once acknowledged my thanks , or existence for that matter. 
  29.     - My grateful thanks go to the funders who made it possible for me to travel. 
  30.     - festivals were held to give thanks for the harvest 
  31.     - All you secretaries who made it this far into the article… thanks for your patience. 
  32.     - So, even though I don't think the photos are that good, thanks for the compliments! 
  33.     - And thanks for warning us that your secret service requires a motorcade of more than 35 cars. 
  34.     - Many thanks for your advice, which as you can see, I have passed on to our readers. 
  35.     - Tom Ryan was given a bottle of wine as a thanks for his active involvement in the twinning project. 
  36.     - Mr Hill insists he has received no recent complaints and has even been sent a letter of thanks from the forum. 
  37.     - Hundreds turned out to pay tribute to a beloved former headteacher at a memorial service to give thanks for her life. 
  38.     - Again, thanks for a well written and much deserved tribute to our good friend George. 
  39.     - I appreciate your doing so, and thanks also for the compliments about the photos! 
  40. See also 
  41.     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 來翻譯文件。

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

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

  1. $ trans -shell en:ta thanks 
  2. Translate Shell 
  3. (:q to quit) 
  4. thanks 
  5. /THaNGks/ 
  6. நன்றி 
  7. (Naṉṟi) 
  8. Definitions of thanks 
  9. [ English -> தமிழ் ] 
  10. noun 
  11.     நன்றி 
  12.         gratitude, thanks 
  13. thanks 
  14.     நன்றி 

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

  1. $ trans -R 

或者   

  1. $ trans -T 
  2. ┌───────────────────┬────────────────────┬────────────────────┐ 
  3. │ Afrikaans      -   af │ Hindi          -   hi │ Punjabi        -   pa │ 
  4. │ Albanian       -   sq │ Hmong          -  hmn │ Querétaro Otomi-  otq │ 
  5. │ Amharic        -   am │ Hmong Daw      -  mww │ Romanian       -   ro │ 
  6. │ Arabic         -   ar │ Hungarian      -   hu │ Russian        -   ru │ 
  7. │ Armenian       -   hy │ Icelandic      -   is │ Samoan         -   sm │ 
  8. │ Azerbaijani    -   az │ Igbo           -   ig │ Scots Gaelic   -   gd │ 
  9. │ Basque         -   eu │ Indonesian     -   id │ Serbian (Cyr...-sr-Cyrl 
  10. │ Belarusian     -   be │ Irish          -   ga │ Serbian (Latin)-sr-Latn 
  11. │ Bengali        -   bn │ Italian        -   it │ Sesotho        -   st │ 
  12. │ Bosnian        -   bs │ Japanese       -   ja │ Shona          -   sn │ 
  13. │ Bulgarian      -   bg │ Javanese       -   jv │ Sindhi         -   sd │ 
  14. │ Cantonese      -  yue │ Kannada        -   kn │ Sinhala        -   si │ 
  15. │ Catalan        -   ca │ Kazakh         -   kk │ Slovak         -   sk │ 
  16. │ Cebuano        -  ceb │ Khmer          -   km │ Slovenian      -   sl │ 
  17. │ Chichewa       -   ny │ Klingon        -  tlh │ Somali         -   so │ 
  18. │ Chinese Simp...- zh-CN│ Klingon (pIqaD)tlh-Qaak Spanish        -   es │ 
  19. │ Chinese Trad...- zh-TW│ Korean         -   ko │ Sundanese      -   su │ 
  20. │ Corsican       -   co │ Kurdish        -   ku │ Swahili        -   sw │ 
  21. │ Croatian       -   hr │ Kyrgyz         -   ky │ Swedish        -   sv │ 
  22. │ Czech          -   cs │ Lao            -   lo │ Tahitian       -   ty │ 
  23. │ Danish         -   da │ Latin          -   la │ Tajik          -   tg │ 
  24. │ Dutch          -   nl │ Latvian        -   lv │ Tamil          -   ta │ 
  25. │ English        -   en │ Lithuanian     -   lt │ Tatar          -   tt │ 
  26. │ Esperanto      -   eo │ Luxembourgish  -   lb │ Telugu         -   te │ 
  27. │ Estonian       -   et │ Macedonian     -   mk │ Thai           -   th │ 
  28. │ Fijian         -   fj │ Malagasy       -   mg │ Tongan         -   to │ 
  29. │ Filipino       -   tl │ Malay          -   ms │ Turkish        -   tr │ 
  30. │ Finnish        -   fi │ Malayalam      -   ml │ Udmurt         -  udm │ 
  31. │ French         -   fr │ Maltese        -   mt │ Ukrainian      -   uk │ 
  32. │ Frisian        -   fy │ Maori          -   mi │ Urdu           -   ur │ 
  33. │ Galician       -   gl │ Marathi        -   mr │ Uzbek          -   uz │ 
  34. │ Georgian       -   ka │ Mongolian      -   mn │ Vietnamese     -   vi │ 
  35. │ German         -   de │ Myanmar        -   my │ Welsh          -   cy │ 
  36. │ Greek          -   el │ Nepali         -   ne │ Xhosa          -   xh │ 
  37. │ Gujarati       -   gu │ Norwegian      -   no │ Yiddish        -   yi │ 
  38. │ Haitian Creole -   ht │ Pashto         -   ps │ Yoruba         -   yo │ 
  39. │ Hausa          -   ha │ Persian        -   fa │ Yucatec Maya   -  yua │ 
  40. │ Hawaiian       -  haw │ Polish         -   pl │ Zulu           -   zu │ 
  41. │ Hebrew         -   he │ Portuguese     -   pt │                       │ 
  42. └───────────────────┴────────────────────┴────────────────────┘ 
想了解更多選項(xiàng)的內(nèi)容,可以查看其 man 手冊。
  1. $ man trans  
責(zé)任編輯:龐桂玉 來源: Linux中國
相關(guān)推薦

2018-11-05 13:50:44

Linux命令tcpdump

2017-06-30 14:51:13

Linux命令行密碼管理工具

2022-10-18 10:00:09

Linuxtcpdump命令

2014-07-31 10:09:12

Linux命令歸檔工具

2021-08-25 10:55:43

Linux命令工具

2014-02-12 13:30:16

Linux命令行終端工具

2023-03-08 15:38:56

Linux命令dict

2020-12-24 17:08:52

安全工具NoSql注入接口工具

2018-10-22 10:00:05

Linux命令ls

2017-03-27 14:40:01

Linux命令行工具技巧

2020-08-21 07:35:12

Linux命令行計算器

2021-07-29 10:00:43

XMLXMLStarletLinux

2010-06-01 19:24:40

SVN命令行

2021-11-16 14:55:50

命令行Linux開源

2022-02-14 08:21:48

Linux元字符

2019-05-21 10:38:17

Linux命令行

2022-07-13 08:21:38

開源命令行工具Linux

2022-04-05 00:18:33

工具終端命令行

2017-04-10 13:26:00

Linux命令技巧

2017-04-12 13:29:08

Linux命令行工具
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號