打印

怎样为stardict做一个新的字典?

怎样为stardict做一个新的字典?

怎样为stardict做一个新的字典?
有这方面的文档和工具吗?

TOP

看了好像没法直接为stardict做新字典,需要先做dictd的字典,然后再转成stardict的字典?
不过我还是没有做成功。
网上也没搜到相关的文档。

TOP

我写了一个测试的字典文件mydic.jargon:
[code:1]
:00-database-short: mydic
:00-database-info: mydic

:aaa: aaaaaaaa
:bbb: bbbbbbbb
[/code:1]

并且编写了一个Makefile:
[code:1]
dictname=mydic

$(dictname).dict $(dictname).index: $(dictname).jargon Makefile
        dictfmt --locale zh_CN.UTF-8 --allchars -j --headword-separator %%% $(dictname) < $(dictname).jargon

install: $(dictname).dict $(dictname).index
        dictzip $(dictname).dict
        cp $(dictname).dict.dz $(dictname).index /usr/lib/dict/
        /etc/init.d/dictd restart

DICTD2DIC=/usr/share/stardict/tools/dictd2dic
stardict_prefix = dictd_www.freedict.de_

$(stardict_prefix)$(dirname).idx.gz $(stardict_prefix)$(dirname).dict.dz dictd2dic.out: $(dictname).dict $(dictname).index $(dictname).idxhead
        $(DICTD2DIC) $(dictname) >dictd2dic.out

$(stardict_prefix)$(dictname).ifo: \
        wordcount=$(word 2, $(shell tail -n1 dictd2dic.out))

$(stardict_prefix)$(dictname).ifo: \
        idxfilesize=$(strip $(shell zcat $(stardict_prefix)$(dictname).idx.gz | wc -c))

$(stardict_prefix)$(dictname).ifo: $(stardict_prefix)$(dictname).idx.gz \
        dictd2dic.out
        @echo "StarDict's dict ifo file" > $@
        @echo "version=2.4.2" >> $@
        @echo "wordcount=$(wordcount)" >> $@
        @echo "idxfilesize=$(idxfilesize)" >> $@
        @echo "bookname=$(dictname)" >> $@
        @echo "author=He Jian" >> $@

stardict: $(stardict_prefix)$(dictname).ifo
        cp $(stardict_prefix)$(dictname).idx.gz $(stardict_prefix)$(dictname).dict.dz $(stardict_prefix)$(dictname).ifo /usr/share/stardict/dic/
[/code:1]

现在能产生dictd的字典,用dict看没有任何问题。
也能产生stardict的字典,但stardict在使用我的这个字典时找不到词?

TOP