
提高Mac字典可读性自定义apple.dictionary的显示样式背景原因解决办法具体操作A more effective way背景使用pyglossary转换 dicts.mdx 为 apple.dictionary 后发现显示样式可读性很差。如图1.图1.原因Pyglossary 转换第三方字典dicts.mdx为apple.dictionary时会自动处理和继承原文件的音频图像资源文件即同一文件夹下的 dicts.mdd 文件但不会自动处理和继承原文件文件的 dicts.css文件即便.css文件和.mdx文件处于同一文件夹中。更根本原因是pyglossary转换压根不会处理css样式问题简而是将被转换字典的css一同忽略、不处理仅在转换结束时为一切的字典生成不同名却同一内容的default_apple.css文件。这个default_apple.css 文件非常简单图2仅包含了非常简单的样式内容如bold、heading、简单的配色等导致至Dictionary Development Kit使用此default_apple.css 执行make命令后得到一个可读性非常差的字典图1。图2解决办法基于上述原因分析解决方法也非常简单。 思路就是在字典转换结束后, make命令前 进入转换所得的dicts.apple文件夹 将原 dicts.css 文件中的文本内容替换到default_apple.css文件中然后再执行make和make install命令。具体操作提前准备好同时带有css文件和mdx文件的cobuild2024词典。使用pyglossary转换mdx文件。结束后不要直接进行make命令。具体步骤请参考我的另一篇文章其中有详细介绍。点击这里apple.dictionary字典制作及EntityRef错误处理直接转跳。进入cobuild2024.apple文件夹。文本编辑器打开cobuild2024_apple.css并将其中的内容替换为cobuild2024.css中的内容并保存。终端cd到cobuild2024.apple文件夹执行 make 命令。出现finish building Done时 说明字典构建完成。然后执行make install命令出现to test the new dictionary 时字典导入完成。到字典.App中检查样式。前后对比A more effective wayOn the desktop, shift command G, paste ‘~/Library/Dictionaries’ to locate and open your personal dictionary directory.Open any dictionary directory and look for the DefaultStyle.css.Just simply replace all the content in the DefaultStyle.css with your desirable css.Reopen Dictionary App.Works got done.