The reason is trivial: I am a fan of the "Word of the Day" screen saver and I would like to add dictionaries for languages other than English and Japanese (these are the two that I can select now in screen saver options).
How can I do it?
dictionarymacosscreensaver
The reason is trivial: I am a fan of the "Word of the Day" screen saver and I would like to add dictionaries for languages other than English and Japanese (these are the two that I can select now in screen saver options).
How can I do it?
Best Answer
On a rather obscure comment thread, someone explained where you might find the word list that Apple uses to power the screensaver. It is at
/System/Library/Graphics/Quartz\ Composer\ Plug-Ins/WOTD.plugin/Contents/Resources/NOAD_wotd_list.txt
. The file looks like this:It is a list of tab-separated entries. On the right you have the word, and on the left, what looks like an ID. But what's it an ID for, and how would you be able to find it for another word not already on the list?
As you might expect, the ID refers to an entry in Apple's default dictionary, the "New Oxford American Dictionary". (That's what "NOAD" stands for in the word-list path above.)
How to find the IDs for other words?
A fellow named Joseph Gentle, in a series of blog posts, shows how to get at the data underlying Apple's dictionaries. In his "Apple dictionaries, part 2" post, he points to code that unpacks the relevant binary file (stored in
/Library/Dictionaries
) into XML. Using thededict.c
andstrip.c
files found here, and following Gentle's example, I used the following bash commands to get at the NOAD's XML (these commands are run from the directory where you downloaded thededict.c
andstrip.c
files):When I
head
-ed the first few lines of thedict.xml
file, I saw something promising, with entries that looked like this:Notice that
id
param... it's an identifier that looks exactly like the one in the screensaver word list!I wrote the following Ruby script to parse the XML, and then, using my own word list, create a new screensaver file that maps my own words to their IDs in the dictionary:
When I replaced the original screensaver file with this new one, it worked. You can now have a "Word of the Day" screensaver that gives definitions for the words you choose.