###转换
下载.DSL to OS X/iOS dictionary converter
https://github.com/svintuss/DSLConverter
####windows xp环境下:
- 安装Python3,(Python2.7会出现以下错误)
import urllib.parse
ImportError: No module named parse
(The urllib.parse library is the Python 3 equivalent of the urlparse library used in Python 2.)
- 安装pytidylib:下载pytidylib源文件,直接编译安装
python setup.py install
;或者用easy_install安装,直接在终端里输入安装命令:easy_install pytidylib
- 下载tidylib.dll,将tidylib.dll文件放到到Python目录下(前提Python路径已添加到系统路径里),其他系统路径应该也可以如:system32目录。
- 转换:
python dslconverter_auto.py <dictionary.dsl>
####MAC OSX环境下:
- 安装Python3
brew install python3
(MAC OSX 10.9.4是默认安装了Python2.7,而DSLConverter里的代码是给Python3用的,python可以多版本并存) - 安装pytidylib,下载pytidylib源文件,直接用Python3编译安装,
python3 setup.py install
。(注意:如果用easy_install pytidylib
命令安装,pytidylib会被安装到Python2.7目录下。) - 转换:
python3 dslconverter_auto.py <dictionary.dsl>
编译
- 下载Auxilliary Tools for Xcode:
打开Xcode:选择Xcode->Open Developer Tool->More Developer Tools登录苹果开发中心,下载Auxilliary Tools for Xcode - 解压出Dictionary Development Kit保存备用,该文件夹有模板、文档、示例,Mac系统词典所有的秘密都在里面。(模板文件在Dictionary Development Kit\project_templates),最好放在
/Volumes/Macintosh HD/Applications/Utilities/DictionaryDevelopmentKit/
(没有空 格) - 在Makefile里设置好相关参数和路径,如DICT_NAME是生成文件的名称,DICT_BUILD_TOOL_DIR是Dictionary Development Kit的路径,如果错了就不能生成文件。
- 编辑模板文件中的Info.plist文件,Bundle name是在Mac字典程序工具栏下面显示的标签名,Bundle identifier需确保名称的唯一性。
- 根据模板格式编辑Dictionary.xml、Dictionary.css,如果有图片则放置在OtherResources/Images目录下.
- 打开终端,cd进入模板文件目录,输入
make
,稍等一段时间,即可生成字典文件,将object目录下生成的dictionary文件拷贝至 ~/Library/Dictionaries,打开字典程序,即可看到生成的字典。
或者直接用make && make install
这个命令,生成词典后直接安装到了~/Library/Dictionaries。
参考
- Windows下Python2.7搭建lxml环境(simplejson+tidylib+libxml2+lxml):
http://www.dzwanli.com.cn/?p=127 - 请教关于 tidylib 的错误问题 :
http://python.6.x6.nabble.com/CPyUG-84982-tidylib-td2871364.html - HTML Tidy for Windows:
http://www.paehl.com/open_source/?HTML_Tidy_for_Windows - PyTidyLib: A Python Interface to HTML Tidy:
http://countergram.com/open-source/pytidylib/docs/index.html#installing-html-tidy - Can’t install pip due to “ImportError: No module named parse”:
http://stackoverflow.com/questions/15011205/cant-install-pip-due-to-importerror-no-module-named-parse - 关于mac词典制作的思考和实践 :
http://coffeejp.com/bbs/thread-383364-1-1.html - 英辞郎をOSX10.9.2にインストール
http://oshiete.goo.ne.jp/qa/8581257.html - How can I create a dictionary for Mac OS X?:
http://apple.stackexchange.com/questions/80099/how-can-i-create-a-dictionary-for-mac-os-x - mac 自带的python到3.3 支持最新的gaogent3.0
https://code.google.com/p/goagent/issues/detail?id=9553
Register a free developer account and download the auxiliary tools package from developer.apple.com/downloads
Move the Dictionary Development Kit folder to /Applications/Utilities/DictionaryDevelopmentKit/ (without the spaces), and copy the project_templates folder to ~/Desktop/
Open ~/Desktop/project_templates/Makefile and change DICT_BUILD_TOOL_DIR from /DevTools/Utilities/Dictionary Development Kit to /Applications/Utilities/DictionaryDevelopmentKit
cd ~/Desktop/project_templates/; make && make install