Saturday, 4 May 2024
blog

ePub Reader Setup – Dictionary

Dictionary

The ePub Reader enables dictionary lookup using web based dictionaries
and offline dictionary apps that you can configure.
A set of dictionaries is enabled by default, and you can modify the list to
include your favourites.

Online Dictionaries

In order to enable a web based dictionary, you need to know the URL that you can use to
invoke a lookup, and that URL must include the word you wish to pass to it. To add a new
dictionary to the available set, you must create a definition file to represent the
dictionary. The file name is the name that will be used to identify the dictionary
and the file content is the URL to invoke in a browser with the word parameter
identified by the string “{word}”.

An example of an online definition file (one of the pre-configured ones), is a text file with
name Merriam-Webster Dictionary. The content of the file is (note the placeholder
representing the word to lookup)

https://www.merriam-webster.com/dictionary/{word}

Offline Dictionaries

By default, the offline dictionary apps
listed below
come pre-configured in ePub Reader. If any of those dictionary apps are
installed on your device, they will be presented as selection options when performing
a dictionary lookup.

In order to enable an additional offline dictionary application, you need to know the details about
how that application accepts requests from other applications (i.e. how it has
configured its Android IntentFilters).
As described above, define new definitions by
creating a definition file, where the file name is the name that will be used to identify
the dictionary.
Note: Adding new offline dictionary app
definitions is a highly technical activity that requires some knowledge of those apps
that may not be available to the casual user. If you have an unsupported dictionary app
that you would like to integrate, please contact me at my support email and I can try
to help out.

The format of the offline dictionary definition file is JSON, containing the following
key/value pairs:

  • "package": "<package_name>"
  • "class": "<class_name>"
  • "category": "<category_id>"
  • "action": "<action_id>"
  • "key": "<word_key_name>"

As a minimum, values for action and key must be included in the definition
file. Other key values may be defined, depending on the requirements of the specific
application.

An example of an offline definition file (again, one of the pre-configured ones), is a text file with
name Aard2 Dictionary. The content of the file is

{
  "package": "itkach.aard2",
  "action": "aard2.lookup",
  "key": "query"
}
			

Manage Dictionary Definitions

Place definition files in the following
directory on your SD card, if you are using the full version of eLibrary Manager:

/Android/data/kpw.ebook/files/dictionary

or, if you are using the free version of eLibrary Manager

/Android/data/kpw.ebook0/files/dictionary

To override any of the pre-configured dictionaries, simply create a new file with the same
name and place it in the above location. The new configuration specified in the replacement file will
override the pre-defined value. If the replacement definition file is empty, it will
remove the pre-configured dictionary from the list (if you want to prune).

For reference, and to provide samples, see the following links which point to copies of the
pre-configured dictionary definition files. To download the files, you may need
to invoke a “Save” operation from the browser, or simply copy the content if it appears
directly in the browser. Remember that the file name is the dictionary name, so if a download
introduces a file extension, you should rename the resulting file to remove the file extension
(unless you like it that way). You’re also free to rename it to whatever you like.

Online dictionary configurations:

Offline dictionary app configurations:

The above online dictionary web URLs were gleaned from
The DICT Development Group, if you’re interested in finding out
more.

Post Comment