7

I saw we have freeict-all in debian.

    $ 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

My use-case is simple, I just want to able to translate phrases from a different language without needing to go to the web. Is it possible or not using the above tool. Even if it's a bit broken, grammar syntax etc. might be worthwhile.

GAD3R
  • 63,407
  • 31
  • 131
  • 192
shirish
  • 11,967
  • 27
  • 107
  • 190
  • @grump that's not true, freedict is a dictionary, not a word list. However, they're not a translation service, and can only help you translate things if you understand the grammar, which is less than what an automated translation service like google translate can do. – Wouter Verhelst Apr 03 '18 at 14:13
  • @WouterVerhelst mea culpa – Grump Apr 03 '18 at 22:40

2 Answers2

10

A command line tool : translate-shell

Translate Shell (formerly Google Translate CLI) is a command-line translator powered by Google Translate (default), Bing Translator, Yandex.Translate, DeepL Translator and Apertium. It gives you easy access to one of these translation engines in your terminal.

apt install translate-shell

e,g:

trans 'Salut!, Bonjour!, Soyez le bienvenu!'

Sample output:

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!

See trans --help for more details.

You can use the -p option to activate the speech synthesizer:

trans 'Buenos días. ¿Cómo estás?' -p

To change the target Language use[source_LANG]:[target_LANG] e,g: (from Spanish to French):

trans es:fr 'Buenos días. ¿Cómo estás?'

or:

trans -s es -t fr 'Buenos días. ¿Cómo estás?'

The home page on github.

Cheloide
  • 103
  • 4
GAD3R
  • 63,407
  • 31
  • 131
  • 192
4

weboob can also do this:

Weboob is a collection of applications able to interact with websites, without requiring the user to open them in a browser. It also provides well-defined APIs to talk to websites lacking one.

I found that Ubuntu 16.04.3 lts has an old version of weboob is it's best to clone it directly from git:

$ git clone https://git.weboob.org/weboob/devel.git weboob && cd weboob

Start translaboob module manually:

$ ./tools/local_run.sh  translaboob

At the first run you'll have to choose a backend you want to use:

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

In this example we choose 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--

After pressing q you can type a sentence to translate, for example:

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
        빠른 갈색 여우는 게으른 개를 뛰어 넘습니다.
Arkadiusz Drabczyk
  • 25,049
  • 5
  • 53
  • 68
  • The [`weboob`](https://packages.debian.org/sid/weboob) package is available through apt. – GAD3R Apr 02 '18 at 12:07
  • 1
    Yes, I know but for example in `Ubuntu 16.04.3 LTS` it's version `1.1` which is very old and `translaboob` does not work. I also said that in my answer. – Arkadiusz Drabczyk Apr 02 '18 at 12:08
  • 1
    one of the dependencies of weboob is no longer available, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866493 – shirish Apr 02 '18 at 14:52