centos translate-shell 本地翻译/离线翻译/本地化翻译 神器

使用此软件完全免费,不需要再接入那些需要收费的api项目,如有道api,腾讯云翻译api,华为翻译api等
《centos translate-shell 本地翻译/离线翻译/本地化翻译 神器》

什么是 Translate Shell

Translate Shell(之前叫做 Google Translate CLI) 是一款借助谷歌翻译(默认)、必应翻译、Yandex.Translate 以及 Apertium 来翻译的命令行翻译器。它让你可以在终端访问这些翻译引擎。 Translate Shell 在大多数 Linux 发行版中都能使用。

如果真的支持离线功能,那么将是真真正正的神器,可惜本软件不支持 (可能是翻译涉及人工智能方面的问题,离线库无法达到?)

安装 Translate Shell

//centos7 及以下版本
# yum install translate-shell

//centos8版本
# dnf install translate-shell

//本地安装
https://github.com/soimort/translate-shell/releases
#cd /usr/local
#wget https://github.com/soimort/translate-shell/archive/refs/tags/v0.9.6.12.tar.gz
#tar zxf v0.9.6.12.tar.gz
#cd translate-shell-0.9.6.12
#make
#make install
#trans -V   //查看版本
---------------------------------------
Translate Shell       0.9.6.12

platform              Linux
terminal type         xterm
bi-di emulator        [N/A]
gawk (GNU Awk)        4.2.1
fribidi (GNU FriBidi) 1.0.4
audio player          [NOT INSTALLED]
terminal pager        less
web browser           xdg-open
user locale           zh_CN.UTF-8 (Chinese Simplified)
home language         zh-CN
source language       auto
target language       zh-CN
translation engine    google

Translate Shell 用法

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

谢谢
(Xièxiè)

நன்றி 的翻译
[ தமிழ் -> 简体中文 ]

நன்றி
    谢谢, 谢谢啦
------------------------------------------------------


# trans :ta "what is going on your life?"
----------------------------------------------------
what is going on your life?

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

what is going on your life? 的翻译
[ English -> தமிழ் ]

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

//要将一个单词翻译到多个语种可以使用下面命令(本例中,我将单词翻译成泰米尔语以及印地语)。
# trans :ta+hi thanks
-------------------------------------
.....
-------------------------------------

纯译文模式: -b

# trans -b :zh "what is going on your life?"
-----------------------------------------------------------------
你的生活怎么样?
-----------------------------------------------------------------

字典模式: -d 

# trans -d :en thanks
-----------------------------------------------------
thanks
/THaNGks/

谢谢
(Xièxiè)

thanks的定义
[ English -> 简体中文 ]

名词
    an expression of gratitude.
        - "festivals were held to give thanks for the harvest"
    同义词: gratitude, gratefulness, appreciation, acknowledgment, recognition, credit, hat tip

同义词
    名词
        - gratitude, gratefulness, appreciation, acknowledgment, recognition, credit, hat tip

示例
    - festivals were held to give thanks for the harvest

    - thanks for being so helpful

    - a letter of thanks

    - many thanks

另请参阅
    thank
-----------------------------------------------------------------

使用下面格式来翻译文件。 段落翻译,多行文本翻译!!!

# trans :ta file:///home/magi/gtrans.txt
# trans en:zh file:///usr/share/nginx/html/python/paddle_ocr/test/01.txt
//格式为一句一行,如下:
---------------------------------------
“HUNDREDS O”
“NAVIGATOR  CAT BURGLAR  NAMI”
“BOUNTY:  JB 366 MILLION”
“EVEN I’D GC  AFTER  SOMEONE  WITH THIS  BOUNTY!”
“OH JJ  YE4H!!”
“MUSICIAN  SOUL KING  BROOK”
“BOUNTY:  JB 383 MILLION”
“YOHO  iOHOH”
“ARE YA  KOON ME?!  I’M NOT EVEN  ON THUS!!”
“SHIPWRIGHT  CYBORG  FRANKY”
“BOUNTY:  j 394 MILLION”

支持语种

# trans -T
┌───────────────────────┬───────────────────────┬───────────────────────┐
│ Afrikaans      -   af │Bahasa Indonesia-   id │ Русский        -   ru │
│ አማርኛ           -   am │ Igbo           -   ig │ ﻱﮅﻨﺳ           -   sd │
│ ﺔﻴﺑﺮﻌﻟﺍ        -   ar │ Íslenska       -   is │ සිංහල           -   si │
│ Azərbaycanca   -   az │ Italiano       -   it │ Slovenčina     -   sk │
│ башҡорт теле   -   ba │ 日本語         -   ja │ Slovenščina    -   sl │
│ беларуская     -   be │ Basa Jawa      -   jv │ Gagana Sāmoa   -   sm │
│ български      -   bg │ ქართული        -   ka │ chiShona       -   sn │
│ বাংলা          -   bn │ Қазақ тілі     -   kk │ Soomaali       -   so │
│ Bosanski       -   bs │ ភាសាខ្មែរ       -   km │ Shqip          -   sq │
│ Català         -   ca │ ಕನ್ನಡ           -   kn │ српски         -sr-Cyrl
│ Cebuano        -  ceb │ 한국어         -   ko │ srpski         -sr-Latn
│ Corsu          -   co │ Kurdî          -   ku │ Sesotho        -   st │
│ Čeština        -   cs │ Кыргызча       -   ky │ Basa Sunda     -   su │
│ Cymraeg        -   cy │ Latina         -   la │ Svenska        -   sv │
│ Dansk          -   da │ Lëtzebuergesch -   lb │ Kiswahili      -   sw │
│ Deutsch        -   de │ ລາວ            -   lo │ தமிழ்           -   ta │
│ Ελληνικά       -   el │ Lietuvių       -   lt │ తెలుగు          -   te │
│ Emoji          -  emj │ Latviešu       -   lv │ Тоҷикӣ         -   tg │
│ English        -   en │ Malagasy       -   mg │ ไทย            -   th │
│ Esperanto      -   eo │ Олык марий     -  mhr │ Tagalog        -   tl │
│ Español        -   es │ Māori          -   mi │ tlhIngan Hol   -  tlh │
│ Eesti          -   et │ Македонски     -   mk │        tlh-Qaak
│ Euskara        -   eu │ മലയാളം         -   ml │ Lea faka-Tonga -   to │
│ ﯽﺳﺭﺎﻓ          -   fa │ Монгол         -   mn │ Türkçe         -   tr │
│ Suomi          -   fi │ मराठी          -   mr │ татарча        -   tt │
│ Vosa Vakaviti  -   fj │ Кырык мары     -  mrj │ Reo Tahiti     -   ty │
│ Français       -   fr │ Bahasa Melayu  -   ms │ удмурт         -  udm │
│ Frysk          -   fy │ Malti          -   mt │ Українська     -   uk │
│ Gaeilge        -   ga │ Hmoob Daw      -  mww │ ﻭُﺩﺭُﺍ           -   ur │
│ Gàidhlig       -   gd │ မြန်မာစာ        -   my │ Oʻzbek tili    -   uz │
│ Galego         -   gl │ नेपाली          -   ne │ Tiếng Việt     -   vi │
│ ગુજરાતી         -   gu │ Nederlands     -   nl │ isiXhosa       -   xh │
│ Hausa          -   ha │ Norsk          -   no │ שידִיי          -   yi │
│ ʻŌlelo Hawaiʻi -  haw │ Nyanja         -   ny │ Yorùbá         -   yo │
│ תיִרְבִע          -   he │ Hñąñho         -  otq │ Màaya T'àan    -  yua │
│ हिन्दी          -   hi │ ਪੰਜਾਬੀ          -   pa │ 粵語           -  yue │
│ Hmoob          -  hmn │ Papiamentu     -  pap │ 简体中文       - zh-CN│
│ Hrvatski       -   hr │ Polski         -   pl │ 正體中文       - zh-TW│
│ Kreyòl Ayisyen -   ht │ ﻮﺘښﭘ           -   ps │ isiZulu        -   zu │
│ Magyar         -   hu │ Português      -   pt │                       │
│ Հայերեն        -   hy │ Română         -   ro │                       │
└───────────────────────┴───────────────────────┴───────────────────────┘

其他

# trans -V
Translate Shell       0.9.6.12
# trans -h
Usage:  trans [OPTIONS] [SOURCES]:[TARGETS] [TEXT]...

Information options:
    -V, -version
        Print version and exit.
    -H, -help
        Print help message and exit.
    -M, -man
        Show man page and exit.
    -T, -reference
        Print reference table of languages and exit.
    -R, -reference-english
        Print reference table of languages (in English names) and exit.
    -L CODES, -list CODES
        Print details of languages and exit.
    -S, -list-engines
        List available translation engines and exit.
    -U, -upgrade
        Check for upgrade of this program.

Translator options:
    -e ENGINE, -engine ENGINE
        Specify the translation engine to use.

Display options:
    -verbose
        Verbose mode. (default)
    -b, -brief
        Brief mode.
    -d, -dictionary
        Dictionary mode.
    -identify
        Language identification.
    -show-original Y/n
        Show original text or not.
    -show-original-phonetics Y/n
        Show phonetic notation of original text or not.
    -show-translation Y/n
        Show translation or not.
    -show-translation-phonetics Y/n
        Show phonetic notation of translation or not.
    -show-prompt-message Y/n
        Show prompt message or not.
    -show-languages Y/n
        Show source and target languages or not.
    -show-original-dictionary y/N
        Show dictionary entry of original text or not.
    -show-dictionary Y/n
        Show dictionary entry of translation or not.
    -show-alternatives Y/n
        Show alternative translations or not.
    -w NUM, -width NUM
        Specify the screen width for padding.
    -indent NUM
        Specify the size of indent (number of spaces).
    -theme FILENAME
        Specify the theme to use.
    -no-theme
        Do not use any other theme than default.
    -no-ansi
        Do not use ANSI escape codes.
    -no-autocorrect
        Do not autocorrect. (if defaulted by the translation engine)
    -no-bidi
        Do not convert bidirectional texts.
    -bidi
        Always convert bidirectional texts.
    -no-warn
        Do not write warning messages to stderr.
    -dump
        Print raw API response instead.

Audio options:
    -p, -play
        Listen to the translation.
    -speak
        Listen to the original text.
    -n VOICE, -narrator VOICE
        Specify the narrator, and listen to the translation.
    -player PROGRAM
        Specify the audio player to use, and listen to the translation.
    -no-play
        Do not listen to the translation.
    -no-translate
        Do not translate anything when using -speak.
    -download-audio
        Download the audio to the current directory.
    -download-audio-as FILENAME
        Download the audio to the specified file.

Terminal paging and browsing options:
    -v, -view
        View the translation in a terminal pager.
    -pager PROGRAM
        Specify the terminal pager to use, and view the translation.
    -no-view, -no-pager
        Do not view the translation in a terminal pager.
    -browser PROGRAM
        Specify the web browser to use.
    -no-browser
        Do not open the web browser.

Networking options:
    -x HOST:PORT, -proxy HOST:PORT
        Use HTTP proxy on given port.
    -u STRING, -user-agent STRING
        Specify the User-Agent to identify as.
    -4, -ipv4, -inet4-only
        Connect only to IPv4 addresses.
    -6, -ipv6, -inet6-only
        Connect only to IPv6 addresses.

Interactive shell options:
    -I, -interactive, -shell
        Start an interactive shell.
    -E, -emacs
        Start the GNU Emacs front-end for an interactive shell.
    -no-rlwrap
        Do not invoke rlwrap when starting an interactive shell.

I/O options:
    -i FILENAME, -input FILENAME
        Specify the input file.
    -o FILENAME, -output FILENAME
        Specify the output file.

Language preference options:
    -l CODE, -hl CODE, -lang CODE
        Specify your home language.
    -s CODES, -sl CODES, -source CODES, -from CODES
        Specify the source language(s), joined by '+'.
    -t CODES, -tl CODES, -target CODES, -to CODES
        Specify the target language(s), joined by '+'.

Text preprocessing options:
    -j, -join-sentence
        Treat all arguments as one single sentence.

Other options:
    -no-init
        Do not load any initialization script.

See the man page trans(1) for more information.
点赞

发表评论

邮箱地址不会被公开。 必填项已用*标注