我看到 debian 中有 freeict-all 。
$ sudo aptitude install dict-freedict-all
[sudo] password for shirish:
The following NEW packages will be installed:
dict-freedict-afr-deu{a} dict-freedict-afr-eng{a} dict-freedict-all
dict-freedict-ara-eng{a} dict-freedict-bre-fra{a} dict-freedict-ces-eng{a}
dict-freedict-ckb-kmr{a} dict-freedict-cym-eng{a} dict-freedict-dan-eng{a}dict-freedict-deu-eng{a} dict-freedict-deu-fra{a} dict-freedict-deu-ita{a} dict-freedict-deu-kur{a} dict-freedict-deu-nld{a} dict-freedict-deu-por{a} dict-freedict-deu-swe{a} dict-freedict-deu-tur{a} dict-freedict-eng-afr{a} dict-freedict-eng-ara{a} dict-freedict-eng-ces{a} dict-freedict-eng-cym{a} dict-freedict-eng-deu{a} dict-freedict-eng-ell{a} dict-freedict-eng-fra{a} dict-freedict-eng-gle{a} dict-freedict-eng-hin{a} dict-freedict-eng-hrv{a} dict-freedict-eng-hun{a} dict-freedict-eng-ita{a} dict-freedict-eng-lat{a} dict-freedict-eng-lit{a} dict-freedict-eng-nld{a} dict-freedict-eng-pol{a} dict-freedict-eng-por{a} dict-freedict-eng-rom{a} dict-freedict-eng-rus{a} dict-freedict-eng-spa{a} dict-freedict-eng-srp{a} dict-freedict-eng-swe{a} dict-freedict-eng-swh{a} dict-freedict-eng-tur{a} dict-freedict-fra-bre{a} dict-freedict-fra-deu{a} dict-freedict-fra-eng{a} dict-freedict-fra-nld{a} dict-freedict-gla-deu{a} dict-freedict-gle-eng{a} dict-freedict-gle-pol{a} dict-freedict-hrv-eng{a} dict-freedict-hun-eng{a} dict-freedict-isl-eng{a} dict-freedict-ita-deu{a} dict-freedict-ita-eng{a} dict-freedict-jpn-deu{a} dict-freedict-jpn-eng{a} dict-freedict-jpn-fra{a} dict-freedict-jpn-rus{a} dict-freedict-kha-deu{a} dict-freedict-kha-eng{a} dict-freedict-kur-deu{a} dict-freedict-kur-eng{a} dict-freedict-kur-tur{a} dict-freedict-lat-deu{a} dict-freedict-lat-eng{a} dict-freedict-lit-eng{a} dict-freedict-mkd-bul{a} dict-freedict-nld-deu{a} dict-freedict-nld-eng{a} dict-freedict-nld-fra{a} dict-freedict-nno-nob{a} dict-freedict-oci-cat{a} dict-freedict-pol-gle{a} dict-freedict-por-deu{a} dict-freedict-por-eng{a} dict-freedict-san-deu{a} dict-freedict-slk-eng{a} dict-freedict-spa-ast{a} dict-freedict-spa-eng{a} dict-freedict-spa-por{a} dict-freedict-srp-eng{a} dict-freedict-swe-deu{a} dict-freedict-swe-eng{a} dict-freedict-swh-eng{a} dict-freedict-swh-pol{a} dict-freedict-tur-deu{a} dict-freedict-tur-eng{a}
0 packages upgraded, 86 newly installed, 0 to remove and 0 not upgraded.
Need to get 48.9 MB of archives. After unpacking 80.1 MB will be used.
Do you want to continue? [Y/n/?] n
我的用例很简单,我只想能够翻译不同语言的短语,而无需访问网络。是否可以使用上述工具。即使它有点破烂,语法语法等也可能是值得的。
答案1
命令行工具:translate-shell
Translate Shell(以前称为 Google Translate CLI)是一个命令行翻译器,由 Google Translate(默认)、Bing Translator、Yandex.Translate、DeepL Translator 和 Apertium 提供支持。它使您可以轻松访问终端中的这些翻译引擎之一。
apt install translate-shell
例如:
trans 'Salut!, Bonjour!, Soyez le bienvenu!'
示例输出:
Salut!, Bonjour!, Soyez le bienvenu!
(null)
Hi!, Hello!, Welcome!
/null/
Translations of Salut!, Bonjour!, Soyez le bienvenu!
[ Français -> English ]
Salut!, Bonjour!, Soyez le bienvenu!
Hi!, Hello!, Welcome!
请参阅trans --help
了解更多详情。
您可以使用以下-p
选项来激活语音合成器:
trans 'Buenos días. ¿Cómo estás?' -p
要更改目标语言[source_LANG]:[target_LANG]
,请使用例如:(从西班牙语到法语):
trans es:fr 'Buenos días. ¿Cómo estás?'
或者:
trans -s es -t fr 'Buenos días. ¿Cómo estás?'
答案2
weboob
也可以这样做:
Weboob 是能够与网站交互的应用程序集合,无需用户在浏览器中打开它们。它还提供了定义良好的 API 来与缺乏 API 的网站进行交互。
我发现Ubuntu 16.04.3 lts
有一个旧版本,weboob
最好直接从以下位置克隆它git
:
$ git clone https://git.weboob.org/weboob/devel.git weboob && cd weboob
手动启动translaboob
模块:
$ ./tools/local_run.sh translaboob
第一次运行时,您必须选择要使用的后端:
Warning: there is currently no configured backend for translaboob
Do you want to configure backends? (Y/n): Y
Available modules:
1) [ ] ebonics English to Ebonics translation service
2) [ ] googletranslate Google translation web service
3) [ ] larousse larousse dictionary translations
4) [ ] wordreference Free online translator
a) --all-- install all backends
q) --stop--
在这个例子中我们选择googletranslate
:
Select a backend to create (q to stop): 2
Backend "googletranslate" successfully added.
Available modules:
1) [ ] ebonics English to Ebonics translation service
2) [X] googletranslate Google translation web service
3) [ ] larousse larousse dictionary translations
4) [ ] wordreference Free online translator
a) --all-- install all backends
q) --stop--
按下后q
您可以输入要翻译的句子,例如:
Select a backend to create (q to stop): q
Right right!
Welcome to translaboob v1.4
Copyright(C) 2012-2018 Lucien Loiseau
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Type "help" to display available commands.
Loaded backends: googletranslate
translaboob> translate en de 'The quick brown fox jumps over the lazy dog'
* googletranslate
Der schnelle braune Fuchs springt über den faulen Hund
translaboob> translate en ko 'The quick brown fox jumps over the lazy dog'
* googletranslate
빠른 갈색 여우는 게으른 개를 뛰어 넘습니다.