free­dict.eu

installing dict­ion­aries offline for Android

While many comprehensive online dictionaries like leo, beolingus or pons are well known you may sometimes also need a dictionary when you have no mobile data or no connection to the internet. Moreover if you want to have the Beolingus/Ding dictionaries on your Android device you will need the offline version as there is no reasonable online app for it. The Beolingus dictionary is a good supplement to Leo as every now and then you can find there translations not present in the more popular Leo.

How to do it

  1. install the Aard2 dictionary program from Playstore or F-Droid.
  2. download and install the dictionaries you want: open Aard2, go to the tab with wordbooks, click on the big plus at the top right and select a .slob wordbook. ‘.slob’ is the native dictionary format of Aard2.

downloading dictionaries

icon of filemanager (Android)
icon of the file management app we recommend

The freedict open source project provides free dictionaries at https://download.freedict.org/dictionaries/. Download or move the .slob dictionaries to your sdcard before adding them with Aard2, because usally the sdcard has more free storage than the internal flash memory of your phone or tablet. If you add first and then move the dictionary it will cease to be available and you have to add once more. An advantage of storing your dictionaries on sdcard is also that you can download with your PC and then copy to the sdcard while your phone or tablet is switched off. You may need to install a file manager to find the download location, create your desired target folder and move the dictionaries there. Downloads can hide as well as under /Android/data/com.android.chrome/files. We recommend the app called “file manager” (German: “Dateimanager”), because it will allow Aard2 to select any location for your dicitionaries like /sdcard/dict. You don´t want to store dictionaries permanently in your download folder. They could get deleted there by accident.

the Ding/Beolingus dictionaries

Ding is a favourite and comprehensive English-German dictionary for Linux. Einhard Leichtfuß has written the ding2tei utility which can convert the ding dictionary into tei-format, the preferred editing format of the freedict project (see: github.com/freedict/tools, importers). From tei the dictionary can be converted with the freedict-toolsMakefile as well as tei2slob on its own to your format of desire. We have compiled and applied ding2tei for you: download the results from https://download.freedict.eu.

Wikipedia & Wikibooks

Wikipedia is not a dictionary but an encyclopedia. Nonetheless it may be useful to have it with Aard2. Look here: https://github.com/itkach/slob/wiki/Dictionaries#wikipedia

converting dictionaries on your own

The freedict project is editing and creating dictionaries in tei format. In order to use dictionaries downloaded as source with Aard2 you may want to convert them on your own. Desktop programs like goldendict use the dict format and you can convert them with dictconv which is f.i. available under Linux as Debian package.

First of all you will need to install tei2slob which is done with the python package manager pip.

> pip install git+https://github.com/itkach/slob.git Defaulting to user installation because normal site-packages is not writeable Collecting git+https://github.com/itkach/slob.git Cloning https://github.com/itkach/slob.git to /tmp/pip-req-build-9jnu4904 Running command git clone --filter=blob:none -q https://github.com/itkach/slob.git /tmp/pip-req-build-9jnu4904 Resolved https://github.com/itkach/slob.git to commit 018588b59999c5c0eb42d6517fdb84036f3880cb Preparing metadata (setup.py) ... done Collecting PyICU>=1.5 Downloading PyICU-2.8.tar.gz (299 kB) |████████████████████████████████| 299 kB 588 kB/s Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: Slob, PyICU Building wheel for Slob (setup.py) ... done Created wheel for Slob: filename=Slob-1.0.2-py3-none-any.whl size=29046 sha256=5fe5a25fcb18440387c65b7988246ed270cde0daa160608c4c38d948123004ed Stored in directory: /tmp/pip-ephem-wheel-cache-h342hh1n/wheels/ed/99/d3/2d00c02277a17c800206ed9afa21d04a5fbdba356bd1a3cc39 Building wheel for PyICU (pyproject.toml) ... done Created wheel for PyICU: filename=PyICU-2.8-cp39-cp39-linux_x86_64.whl size=1713599 sha256=21976bfa982b92c23f428810ba5751f8a2efe1fa0766da712c9af572de3cfae4 Stored in directory: /home/elm/.cache/pip/wheels/9a/a6/77/1ffaea5855cb69dff1b22d051a7eb2b52d638409ed85dceab6 Successfully built Slob PyICU Installing collected packages: PyICU, Slob > pip install git+https://github.com/itkach/tei2slob.git Defaulting to user installation because normal site-packages is not writeable Collecting git+https://github.com/itkach/tei2slob.git Cloning https://github.com/itkach/tei2slob.git to /tmp/pip-req-build-um1lmatz Running command git clone --filter=blob:none -q https://github.com/itkach/tei2slob.git /tmp/pip-req-build-um1lmatz Resolved https://github.com/itkach/tei2slob.git to commit 177872851938e2e2cdf7b26f451ba7e6f8efb349 Preparing metadata (setup.py) ... done Building wheels for collected packages: tei2slob Building wheel for tei2slob (setup.py) ... done Created wheel for tei2slob: filename=tei2slob-1.0-py3-none-any.whl size=6943 sha256=adc445187f517e1972022bb0fc44c96f74df80b1c8278eb655fbcb96b4f63466 Stored in directory: /tmp/pip-ephem-wheel-cache-wayrkkjg/wheels/3a/58/5c/d0a724c2e1df1de99a4218aa027cf920d331f56d2af05c31b4 Successfully built tei2slob Installing collected packages: tei2slob Successfully installed tei2slob-1.0

You can visit the homepage of these two software projects at https://github.com/itkach/slob/ and https://github.com/itkach/tei2slob/.

Look here on how to convert into slob:

> tar -xvJf freedict-por-deu-0.2.src.tar.xz por-deu/AUTHORS por-deu/ChangeLog por-deu/COPYING por-deu/por-deu.tei por-deu/INSTALL por-deu/Makefile por-deu/NEWS por-deu/README por-deu/freedict-P5.dtd por-deu/freedict-P5.rng por-deu/freedict-P5.xml por-deu/freedict-dictionary.css > ~/.local/bin/tei2slob por-deu/por-deu.tei Adding /home/elm/.local/lib/python3.9/site-packages/tei2slob SKIPPING (not included): '__init__.py' ADDING: '~/css/default.css' ADDING: '~/css/night.css' SKIPPING (not included): '__pycache__/__init__.cpython-39.pyc' ADDING: '~/js/styleswitcher.js' Adding content... .................................................. 5000 ................................. Finished adding content in 0:00:02 Finalizing... Sorting... sorted in 0:00:00 Resolving aliases... Sorting... sorted in 0:00:00 Resolved aliases in 0:00:00 Finalized in 0:00:00 All done in 0:00:03

installing tei2slob offline

You may not just want to use your dictionaries offline but you may want to convert on an offline machine. To do so you do not only need to install the two packages slob and tei2slob but you may need to upgrade and install some core pip packages. To download python packages for offline use, make use of https://pypi.org. With Debian 10 there is a pipenv packages which you can use to install pipenv to use instead of pip. You may also directly use pip by python3 -m pip --version/install etc.. To see what base packages I had to install manually look at the output of pipenv graph. Note that if you need a newer version of an already installed package you may want to execute pip install --upgrade pkgname. See if a package is already installed by python3 -m pip list.

> pipenv graph pkg-resources==0.0.0 pypi-simple==0.9.0 - beautifulsoup4 [required: ~=4.5, installed: 4.10.0] - soupsieve [required: >1.2, installed: 2.3.1] - packaging [required: >=20, installed: 21.3] - pyparsing [required: !=3.0.5,>=2.0.2, installed: 3.0.6] - requests [required: ~=2.20, installed: 2.27.1] - certifi [required: >=2017.4.17, installed: 2021.10.8] - charset-normalizer [required: ~=2.0.0, installed: 2.0.10] - idna [required: >=2.5,<4, installed: 3.3] - urllib3 [required: <1.27,>=1.21.1, installed: 1.26.8]

Unfortunately pip does not really seem to be written for offline usage. It often tries to fetch data from https://pypi.org/simple/…. As long as pip reports that the package has been successfully installed, there is nothing you need to care about:

… Successfully installed tei2slob-1.0 Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1056)'))) - skipping

There was one package I had to install manually without pip: PyICU-2.8. I simply unzipped the package and followed the instructions in the PKG-INFO file. There was nothing more to do than to run python3 setup.py build and sudo python3 setup.py install. Alternatively I could have cleanly created a pip package and then have tried to install this package.

Finally I almost forgot to say on how to fetch the tei2slob and slob repositories for offline usgae: git clone tei2slob. Then simply pip install on the directory rather than an URL or zip-filename.