0

John Gruber recently tweeted on Mastodon:

One of my favorite features on the Mac [...] is adding new words to the system-wide spelling dictionary. The feature dates back to Mac OS X 10.0 and I'm pretty sure was in NeXTStep a decade before that.

And, even better, the custom words you add to the dictionary are stored in a simple text file, one word per line, at:

~/Library/Group Containers/group.com.apple.AppleSpell/Library/Spelling/LocalDictionary

https://mastodon.social/@gruber/112560468582323979

In my case, the file is actually at ~/Library/Spelling/LocalDictionary, because I'm crazy and run an ancient version of macOS (10.9 Mavericks). I don't think this is relevant to the rest of my question.

After taking a peek at LocalDictionary, something caught my attention. ~/Library/Spelling/ contains another text file, en, which like localdictionary contains one word per line. These words are different from the ones in localdictionary, but like locationdictionary they seem like things I probably typed over the past few years and wanted spellcheck to learn about. For example, it contains the name of the organization I work for, and some people I know with unusual first names.

What is this en file, and how is it populated? Why do some words end up in en while others end up in LocalDictionary?

(I assume that on modern macOS, the equivalent file is located in ~/Library/Group Containers/group.com.apple.AppleSpell/Library/Spelling/en)

1
  • If this gets closed or downvoted, you can edit this to explain what you’re trying to do if there’s something deeper than curiosity on the implementation details.
    – bmike
    Commented Jun 9 at 2:39

1 Answer 1

2

The string en is the ISO 639-1 Code for English language text. Apple has frameworks to allow the same program to use different files for different locales (which is a combination of ISO 639-1 language and an underscore followed by an ISO 3166-1 region designator such as en_US or en_GB.)

Localized files typically are stored in directories using these abbreviations or have them appended in a standard way for each language and/or region that is ready for use.

Why Apple does things is generally off topic here for reasons discussed on the meta site. You’d need to reverse engineer what they did or find them documenting which words go where, but knowing them and their design thinking, my hunch is if the program you are spell checking is aware of multiple languages, Apple files those words in a language-specific dictionary. This would allow them to track words spelled differently in different languages and correctly store and suggest only language-correct spellings.

All other custom words would go in the non-language-coded repository.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .