Skip to content

Apple Dictionary

The built-in macOS dictionary offers excellent lookup functionality activated by force touch (or tapping with three fingers); sadly, this feature is not supported on all applications. Therefore, I want to integrate the lookup feature from Apple Dictionary into Easydict, providing a swift and convenient word search using the system dictionary.

Easydict supports built-in dictionaries within Dictionary.app, including dictionaries like the Oxford English-Chinese Dictionary (Simplified Chinese-English) and the Modern Chinese Standard Dictionary (Simplified Chinese). To utilize these dictionaries, simply activate them within Dictionary.app.

image-20230928213750505

Furthermore, Apple Dictionary also supports custom import dictionaries. This means that we can add third-party dictionaries like the Concise English-Chinese Dictionary or the Longman Dictionary of Contemporary Advanced English by importing them in the .dictionary format.

Adding third-party dictionaries

⚠️ To alleviate concerns related to copyright, acquire your paperback copy or app.

The easiest way to add a dictionary to macOS is to find a converted .dictionary file, drag it into the Dictionary folder of Apple Dictionary, and then restart the Dicionary.app to ensure the new dictionary appears in the Settings.

Attention: Each time a new dictionary is added, Easydict needs to be restarted to see the changes in effect. Also, modifying the dictionary application settings may cause Easydict to crash; this is an expected behaviour.

For your convenience, I've created several .dictionary files and put them on Google Drive, so you can directly download and use them.

Longman, Collins, and Oxford are three substantial yet outstanding dictionaries. However, due to the extensive content in their entries, they may impact the loading speed of Easydict queries. Therefore, it is advisable to select only one of your favourites.

DictionaryTypeSource.dictionary 下载
Concise English-Chinese dictionaryChinese-EnglishGitHubhttps://drive.google.com/file/d/1-RoulJykOmcADGRHSmUjX2SkwiyLTHP1/view?usp=sharing
Youdao Words AnalysisChinese-Englishfreemdicthttps://drive.google.com/file/d/1-HGanRhQDRR0OSMLb19or07lPwn_R0cn/view?usp=sharing
Great CictionaryChinese-Englishmdicthttps://drive.google.com/file/d/1-8cBLcuA_N4PAjIMn_-d03ELv4uVrmIr/view?usp=sharing
Longman Dictionary of Contemporary Advanced EnglishChinese-Englishv2exhttps://drive.google.com/file/d/1-7g-hDiwqAFtweL1qePKSRcGFJvruu97/view?usp=share_link
Collins Advanced English-Chinese DictionaryChinese-English《柯林斯双解》for macOShttps://drive.google.com/file/d/1-KQmILchx71L2rFqhIZMtusIcemIlM01/view?usp=share_link
Oxford Advanced Learner's English-Chinese Dictionary (8th Edition)Chinese-EnglishJianshuhttps://drive.google.com/file/d/1-N0kiXmfTHREcBtumAmNn4sUM5poyiC7/view?usp=share_link
Oxford Advanced Learner's English-Chinese Dictionary (8)Chinese-EnglishSource unknown, I modified the css myselfhttps://drive.google.com/file/d/1-SigzdPPjQlycPwBHICgQSUOHpR8mMf7/view?usp=share_link

Concise English-Chinese dictionary

image-20231001175045564

Youdao Words Analysis

image-20231001182349593

Great Cictionary

Longman Dictionary of Contemporary Advanced English

image-20231001184055245

Collins Advanced English-Chinese Dictionary

image-20231001184454574

Oxford Advanced Learner's English-Chinese Dictionary (8th Edition)

image-20231001185812289

Oxford Advanced Learner's English-Chinese Dictionary (8)

I can't remember the source of this dictionary, but the point is that the css of this dictionary was tuned by myself when I was learning how to make dictionaries, and the internal DefaultStyle.css file has detailed annotations, so beginners who want to try to customize the interface of the dictionary can start from this css.

image-20231001190542557

How to make a .dictionary dictionary

Attention: This part of the doc is aimed at advanced users, who need a bit of programming knowledge and love to spend time on this.

Below is an introduction to how to use the open-source project pyglossary to convert Mdict dictionaries into .dictionary files. This doc is based on pyglossary apple.

Preparations

  1. Install Python library
shell
sudo pip3 install lxml beautifulsoup4 html5lib
  1. Install Command Line Tools for Xcode

  2. Install Dictionary Development Kit

    Dictionary Development Kit is part of Additional Tools for Xcode, after downloading, you need to move Dictionary Development Kit to/Applications/Utilities/Dictionary Development Kit.

  3. Download pyglossary

    Please move the downloaded pyglossary library to a fixed directory, you will need it every time you convert a dictionary.

    Assuming that pyglossary-master is located at ~/Downloads/pyglossary-master

Mdict dictionary resources are available from the following website:

Now let's begin.

Steps of conversion

Suppose the dictionary file in Mdict format is located in ~/Downloads/oald8/oald8.mdx, and the picture and speech file oald8.mdd are also in the same folder.

shell
cd ~/Downloads/oald8/

python3 ~/Downloads/pyglossary-master/main.py --write-format=AppleDict oald8.mdx oald8-apple

cd oald8-apple

sed -i "" 's:src="/:src=":g' oald8-apple.xml

make

If all goes well, you will end up with an objects file in that directory, with oald8-apple.dictionary in it, which is the converted Apple dictionary, which you can drag into the Dictionary folder.

Note that the dictionary generated above has a very simple interface, and usually Mdicts circulating on the web will come with a copy of beautified css, such as oald8.css. Since pyglossary does not handle css automatically, we need to do it manually by copying the contents of oald8.css and appending it to the DefaultStyle.css inside the oald8-apple.dictionary file. If you want to customize the css, you also modify this file.

The name of the dictionary can be changed via Info.plist, where the Bundle name is the name of the dictionary to be displayed in the application interface, and the Bundle display name is the name of the dictionary to be displayed in the settings page. For convenience, it is recommended that both be set to the same value.

END.

image-20231002184455216

References (Chinese)