Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I would like to have a way to dynamically add and remove words from the system-wide dictionary in Mountain Lion. The use-case is:

  1. I'm working on a piece of fiction that has a lot of odd names in it that I would like spell-checked -- hit some key-combination that loads those odd name into the dictionary list of known words
  2. I'm done working on the fiction and I no longer want those words polluting my dictionary -- hit some key-combo to unload those words from the dictionary

I could be working on two separate pieces of fiction and would want to load and unload each list separately. I'm not looking for an app with a custom spell-checker; I'm definitely looking for something that works with the built-in, system-wide spell checking sub-system.

All solutions considered: open source, paid applications, AppleScript, Automator, shell scripts -- anything and everything.

share|improve this question

1 Answer 1

When you press the Learn button, the word is added to ~/Library/Spelling/LocalDictionary if the language is set to automatic or to ~/Library/Spelling/en if the language is set to U.S. English. en_GB is used for British English and en is used only for U.S. English.

If you edit the files in ~/Library/Spelling/ directly, you can apply the changes by terminating the AppleSpell process.

So try to assign a shortcut to a script like this:

cd ~/Library/Spelling
if [[ -e fiction ]]; then
  mv en normal; mv fiction en; d=fiction
else
  mv en fiction; mv normal en; d=normal
fi
killall AppleSpell
terminal-notifier -title "Using dictionary $d" -message '' -group spellingdictionary
sleep 3
terminal-notifier -remove spellingdictionary

If for example you use the British English dictionary, change en to en_GB.

You can install terminal-notifier with sudo /usr/bin/gem install terminal-notifier.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.