Q&A: A dictionary of placenames

Q How can I set up a dictionary of placenames, which I can then access throughout my applications?

A One of the really neat features about more recent versions of OS X is support for custom dictionaries in the Dictionary application.

Although there are alternatives, and individual apps support their own lightweight user dictionary formats, the most universal approach is to cast your content into Dictionary’s XML format and convert it into a standard OS X dictionary using Apple’s free Xcode, available from the App Store.

At its most basic, the XML format required is quite simple, as in this single entry:
<d:entry id="lee_on_the_solent" d:title="Lee-on-the-Solent" d:parental-control="1">
<d:index d:value="Lee-on-the-Solent"/>
<div d:priority="2"><h1>Lee-on-the-Solent</h1></div>
<ul>
<li>
seafront town between Warsash and Gosport on northern shore of eastern Solent. Flat and replete with elderly cyclists.
</li>
</ul>
</d:entry>

If you already have entries stored in the document format for a different app, you may be able to export them in plain text, and use a text editor to convert them into a rough outline ready to tidy up into this format.

More complex entries can include synonyms, derivatives and relatives, pronunciation using symbols of the International Phonetic Alphabet (IPA), and extended content. Take a look at the dictionaries that come bundled in OS X and are accessed through the Dictionary app to see if that has the features that you want.

Apple provides example XML files and full documentation through its developer support site, which you can access through Xcode. Once you have built the content and created your dictionary, all you have to do to install it is to place a copy of the compiled dictionary in the Dictionaries folder in one of your Library folders. Once there you can add it to Dictionary’s portfolio by enabling it in its preferences.

Comments If you wanted something that you could extend on the fly, for instance adding new entries as you go along, Dictionary is the wrong application; you should then look at a database such as FileMaker Pro, which can embed images and other media into its records, but is relatively straighforward to use.

Further details are in this article.

Updated from the original, which was first published in MacUser volume 29 issue 07, 2013.