-
Notifications
You must be signed in to change notification settings - Fork 19
android
See SilverDict-mobile.
The mobile app is independent of the web app, though sharing the same back-end and much code. It has all the functionality you would expect from a dictionary app and looks more polished than the web app.
After start-up, go to the settings and set the server address. The default is http://localhost:2628
, which is the address of the server running on the same device. To connect to a server running on another device in the local network, you need to find out its IP address and change localhost
to that one. Or you can also deploy the server on the Internet and connect to it from anywhere.
- When the search bar is empty, history is displayed; otherwise suggestions are displayed.
- Tap on the bookshelf icon to select groups or jump to a specific dictionary.
- Tap on a word to search for it.
- If you see little boxes or question marks, please download additional fonts in the settings page (see below).
- Tap on one to rename or delete
- Long-press (drag-and-drop) to reorder. Their relative order will be reflected in all groups.
- Long-press on Languages/Dictionaries to edit.
- Drag and drop to reorder.
No 'hidden' features here.
- Additional fonts: here you can select which scripts (instead of languages) you would like to download additional fonts for. They will be downloaded and cached next time you start a new query.
The server is a Python application, so it can be run on Android using Termux. After installation, first run termux-setup-storage
to grant access to the external storage. Then download the archive SilverDict.zip
from the releases page and unzip it somewhere. Now run the bash script termux_setup.sh
inside the unzipped folder. It will install the necessary packages, set up a default dictionary source at /sdcard/Documents/Dictionaries
and create two shortcuts (see below). During the process, pkg
may prompt you to choose between some options. Just press 'enter' to select the default in each case.
Now you can run the server with python server/server.py
and it will listen at 127.0.0.1:2628
. A convenient way to start the server is to use the Termux plug-in Termux:Widget: add the widget to the home screen and put into ~/.shortcuts
a bash script like this:
#!/bin/bash
python /storage/emulated/0/SilverDict/server/server.py
If you set SilverDict up with the bash script, two shortcuts SilverDict-Start.sh
and SilverDict-Stop.sh
will be created in ~/.shortcuts
. The first one acquires a wakelock, starts the server in the background, saving the log to ~/.silverdict/server.log
; the second stops the server and release the acquired wakelock.
Note: the installation script installs the legacy PyHunspell. Sibel is recommended as an alternative. It doesn't install Xapian or the Python bindings. To use full-text search, first install the Xapian packages with pkg and grab the source code of xapian-bindings
and run the following commands:
pkg install libxapian xapian-tools binutils-is-llvm
pip install sphinx
export CFLAGS=$(python-config --cflags)
export CXXFLAGS=$(python-config --cflags)
export LDFLAGS=$(python-config --ldflags)
export LIBS=$(python-config --libs)
./configure --prefix=$PREFIX --with-python3
make
make install
Indexing dictionaries and creating the ngram index is a time-consuming process, so it is recommended to do it on a PC and then copy the files to the Android device. Follow the steps below to do that.
- Rename to your existing SilverDict directories (
~/.silverdict
and~/.cache/SilverDict
) to something else, e.g..silverdict.old
. - Start the server with
python server.py
. - Put all dictionaries you'd use on Android into
~/.silverdict/source
. - Run
curl http://localhost:2628/api/management/scan
to index the dictionaries, or do it in the web UI. - Run
curl http://localhost:2628/api/management/create_ngram_table
to create the ngram index, or do it in the web UI, if you want to use the ngram search (both-sides expansion). - Change
~/.silverdict/preferences.yaml
to your liking. - Change the filenames in
~/.silverdict/dictionaries.yaml
to reflect their paths on Android. - Fix any symbolic links in
.silverdict/cache/SilverDict
. - Move
~/.silverdict
and~/.cache/SilverDict
to Termux.
Then you are all done.
Try turning off 'battery optimisation' for Termux, which interferes with the server's ability to run in the background. Here's how to do it (on a Samsung Galaxy with Android 12): Settings -> Apps -> Termux -> Battery -> Unrestricted.
See this discussion.
In short, it is probably due to the inherent limitation of the Android platform and the Arm architecture.