Dictionary management for stardict

March 27, 2009
Dictionaries

Recently I messed around with stardict configuration. I've received new dictionary pack, so the whole their quantity exceeded a hundred. It appears that dictionary management via interface isn't user-friendly. Finally I wrote the script that extracts information about dictionary groups from stardict config file into a separate XML file. This file could be easily edited by hand. Reverse operation is also available.

Usage

You should close stardict before you start using the script as it reads and writes main configuration file ~/.stardict/stardict.cfg. After executing of

# stardict-dict-config.sh extract

you will discover a new file ~/.stardict/dict_config.xml with the similar contents:

<dictgroup name="Default Group">
	<querydict>
		<localdict enable="true" file="/usr/share/stardict/dic/dictd_www.mova.org_slovnyk_ru-en.ifo"/>
		<localdict enable="true" file="/usr/share/stardict/dic/dictd_www.mova.org_slovnyk_en-ru.ifo"/>
		<localdict enable="true" file="/usr/share/stardict/dic/en-ru-bars.ifo"/>
		<localdict enable="true" file="/usr/share/stardict/dic/Mueller7GPL.ifo"/>
		<virtualdict enable="false" id="/usr/lib/stardict/plugins/stardict_man.so"/>
		<netdict enable="false" id="/usr/lib/stardict/plugins/stardict_dictdotcn.so"/>
	</querydict>
	<scandict>
		<localdict enable="true" file="/usr/share/stardict/dic/dictd_www.mova.org_slovnyk_ru-en.ifo"/>
		<localdict enable="true" file="/usr/share/stardict/dic/dictd_www.mova.org_slovnyk_en-ru.ifo"/>
		<localdict enable="true" file="/usr/share/stardict/dic/en-ru-bars.ifo"/>
		<localdict enable="true" file="/usr/share/stardict/dic/Mueller7GPL.ifo"/>
		<virtualdict enable="false" id="/usr/lib/stardict/plugins/stardict_man.so"/>
		<netdict enable="false" id="/usr/lib/stardict/plugins/stardict_dictdotcn.so"/>
	</scandict>
</dictgroup>

You can swap lines in it with your favorite editor, replace from enable="true" to enable="false" in selection, create new dictionary groups, etc. To send this settings to stardict.cfg you need to run

# stardict-dict-config.sh merge

To delete information about dictionary groups from stardict config execute

# stardict-dict-config.sh remove

Stardict will create default group with all dictionaries at the next start.

Note that before any modification of any config file the script will create a backup.

Script

Download stardict-dict-config.sh, version 0.1.

Nikita Melnichenko.

Comments

Ilya Potapov
29.11.2009, 13:39

Thank you very much!!!
I've expierenced same problem in stardict ui) It's terrible in working with hundred of dictionaryies.
Your script is very usefull :)

Bjørge Solli
25.01.2010, 12:40

Hi, is it possible to have a situation where the dictionaries are in the users home dir and each user has his or hers own dictionaries?

Please reply to bjorge.solli (at) it.uib.no if you can assist in acheaving this setup.

Regards
Bjørge Solli

Nikita Melnichenko
25.01.2010, 19:29

Of course it's possible! Put user's dictionaries at $HOME/.stardict/dic/

Add comment

Text will be published as is. No HTML allowed. key