Shell script to toggle spelling language

Well, there’s only so

Similar error message on Ventura.

Try this:

use framework "Foundation"
use framework "AppKit"
use scripting additions

set spellChecker to current application's NSSpellChecker's sharedSpellChecker()
set theLang to spellChecker's |language|() as string
if theLang = "fr" then
	spellChecker's setLanguage:"en"
	spellChecker's setLanguage:"fr"
end if

No error message, unfortunately it doesn’t seem to have any effect :frowning:

Thanks all the same.

I realize that I am totally off topic.
NSSpellChecker only creates an instance of the spell checking system for the current host.
The settings can only be changed for the current script or application.

Sorry for the false hope…

No worries. Thanks for looking into it.

No one has been able to figure it out yet. Changing the spelling language manually through system settings makes open apps see the change, so it has to be possible programmatically.

If only Apple provided an easy way to do this natively…