This helm source can be used to look up words in local (offline) dictionaries. It also provides short-cuts for various online dictionaries, which is useful in situations where the local dictionary doesn't have an entry for a word.
Dictionaries are available for a variety of language pairs; see below.
Helm-dictionary can be installed via MELPA. Alternatively, put the file
helm-dictionary.el in your Emacs-Lisp load path and add the following in your Emacs start-up file:
Alternatively, you can use autoload:
(autoload 'helm-dictionary "helm-dictionary" "" t)
Configure local dictionaries
In order to specify a dictionary set the variable
helm-dictionary-database to the file name of that dictionary.
A dictionary for German and English can be found in the Debian package trans-de-en. This package is also available in many distributions derived from Debian such as Ubuntu. Alternatively, this dictionary can also be downloaded here:
A dictionary for German and Spanish can be found here:
A variety of dictionaries with English as the source or target language can be found here:
These dictionaries were automatically created from the Wiktionary database. Their size and quality may vary. Also generated from Wiktionary are the following dictionaries with Russian as the source or target language:
Configure online web dictionaries
If the local dictionary doesn't have an entry for a word, it can be useful to try online dictionaries available on the web. Helm-dictionary has a dummy source that provides shortcuts for looking up the currently entered string in these online dictionaries. The variable
helm-dictionary-online-dicts specifies which online dictionaries should be listed. The value of that variable is a list conses. The first element of each cons specifies the name of an online dictionary for display during searches. The second element is the URL used for retrieving search results from the respective dictionary. This URL has to contain a "%s" at the position where the search term should be inserted.
The browser specified in
helm-dictionary-browser-function will be used to show results from online dictionaries. If this variable is nil (default), the value of the variable
browse-url-browser-function will be used (the currently configured Emacs-wide default browser). If that variable is also nil, helm uses the first available browser in
Use the command
M-x helm-dictionary to start a new search or bind
helm-dictionary to a key. As usual, a search is case-insensitive unless the expression contains capital letters. Regular expressions can also be used as search terms. Specifically, you can use
\b to denote word boundaries when you want to search for complete words, e.g.,
\bhouse\b when you only want the entry for the word house but not entries like household and workhouse.
You can use
M-n to insert the word on which you called
helm-dictionary (works in all helm sources).
There are two actions available: insert the currently selected term in the source language (left) or in the target language (right) at point, i.e., the cursor position at which
helm-dictionary was called.
In the section Look up online, you can choose among several online dictionaries. If you select one of the entries listed in this section, a browser will be used to display search results from the respective dictionary.