dict: improve overriding of default server and dictionary
runners/dict
and applets/dict
use DictEngine
to query for words. The default server and dictionary can be overridden by passing them as part of the query itself. For example to use dict.myserver.com
as server and wn
for dictionary:
- To override dictionary in
runners/dict
:define wn:hello
- To override server and dictionary in
runners/dict
:define dict.myserver.com:wn:hello
- To override server and dictionary in
applets/dict
:dict.myserver.com:wn:hello
The query is passed to DictEngine::requestDefinition
where the engine sets the server and dictionary.
Problems
- This is a hard to use feature as the end user is expected to know the server name and dictionary. I think very few users even know about this.
- If the applet or runner making use of
DictEngine::requestDefinition
want to override the default server they are also forced to pass the dictionary name.
Solution
- Dropped the existing functionality of specifying server and dictionary in the query to override the defaults.
- Overloaded
DictEngine::requestDefinition
to allow overriding of dictionary, server or both.
applets/dict
Changes to - Now definition is requested using
requestDefinition(query, dictionary)
instead of passing the dictionary in the query itself. - Users won't be able to override server and dictionary from the query itself like
dict.myserver.com:wn:hello
but they can still directly search the word.
runners/dict
Changes to - Users won't be able to override server and dictionary from the query itself like
define wn:hello
ordefine dict.myserver.com:wn:hello
but they can still dodefine hello
.
Note
- This would break The fix to applets/dict
. I plan to make a follow up MR to fix it.applets/dict
has been added to this MR itself.
Edited by Bacteria Dev