Main menu:

Site search


July 2017
« Oct    




Switching spelling languages

If you’re like me, then you probably write one email in language X and another one in language Y and you’re getting tired of always switching the spell checker language to stop every word being underlined in red. That means pressing command + shift + “:”, selecting the correct language and then close the spell check window since it consumes precious screen real estate.

So of to Google to find a simple utility which could switch languages faster and a bit more user friendly. Disappointingly, I couldn’t find any. The closest I found (although I have to admit I didn’t search very long) was using a applescript on MacOSXhints.

Having a bit of free time during the Christmas festive season, I decided to make such a utility myself. This shouldn’t be hard.

I first tried if I could achieve something by using the NSSpellChecker API. I had some hopes that I could set my preferred language system wide by using this API. However it quickly became clear that making any changes using the NSSpellChecker API stayed local to my own application and that I couldn’t use this API to change the language of e.g. Bummer.

So I took a look again at the applescript solution and decided to make a standalone CoCoa application around it. As it turned out, this introduced some new problems.

The applescript solution as presented in the MacOSXhints forum hardcodes the 2 languages you want to switch to and you always need run the applescript which seemed hardly a user improvement to me. What I wanted was a small utility that nested itself in the status bar allowing to quickly switch to another language using a drop down menu. To make it a bit more user friendly, the last 2 languages I switched to, would automatically become the first 2 entries in the menu.


The first problem I encountered was the strange difference between the display names of the languages as they were returned by OS X and the shown languages in the spelling window.


For the applescript to work correctly, you really need to tell the popup menu to select e.g. “Australian English” instead of “English (Australia)”. A simple solution could be to use a simple lookup table. However that would open another can of worms. Depending on the language you are using OS X, the name of language in use will be localized to your preferred language. E.g “Australian English” would become “Australisch Engels” in Dutch. To make it even more fun. Suppose you’re writing an email using the Dutch language setting of OS X then you would indeed see the Dutch localized display name (”Australisch Engels”). However, open the spelling window in e.g. Xcode and you will see the English display name (”Australian English”) simply because Xcode hasn’t been localized for Dutch. Trying to solve this becomes a small nightmare if you want to support a lot of languages.

I found a rather simple workaround for this. Looking more closely to the menu in the above screenshot, you’ll see that the order of the languages stays the same. If I select item 1, I will always select “Australian English” no matter what language my OS X is running at that moment.

Another [related] problem then pops up. The applescript looked for a window with the title “Spelling and Grammar”. This is fine when you only use the English version of OS X, but in other languages, this window gets a localized name and the applescript doesn’t work anymore. Below you can see the same window for Dutch, English, French and German (the 4 most used languages in Belgium, in alphabetical order).

Spelling en grammatica.png

Spelling and Grammar.png

Orthographe et grammaire.png

Rechtschreibung und Grammatik.png

So I modified the applescript to look for one of those windows and if one of them exist to perform the click on the popup menu, select the wanted language and close the window again.

Important: If the application doesn’t work, check in System Preferences -> Universal Access if support for assistive devices is allowed. Make sure that the checkbox for “Enable access for assistive devices” is checked.


You can download a small Xcode project (Leopard only) which should work fine for Dutch, English, French and German localized versions of OS X. It should be straightforward to add any language you want.

This small tool is certainly not going to win any beauty contests (using applescript means that you will see the spell checker window open and close again which is a bit annoying) but it does get the job done for me.

Xcode project can be downloaded here:
A prebuilt application can be downloaded here:

Write a comment

You need to login to post comments!