Spell checking language questions

In the standard macOS spell checker panel there’s an option at the bottom of the window to select a specific language or use the default “Automatic by Language” option:


.

Is that an important and used setting by anyone here? I assume it is, since its in default spell checker, but I’m also curious about the specific scenarios where “Automatic by Language” isn’t sufficient.

Second, assuming it is important, where should that language setting state be stored? It it part of the current view or document? So for example if you have a document open and are viewing that same document with multiple windows… when the setting changes in one window should that change also effect the other window? Or on the other hand is would it be better to have one window checking in one language and another window checking in another language?

Thanks!

Automatic by Language is what I’ve always used.

1 Like

I should probably know more about how the system settings are determined, but my documents can get a little bit mixed, and I do have a few different languages checked under:

System Preferences > Language and Region > Keyboard Preferences
    > Text > Spelling > Set Up ...

Automatic detection is quite good for monolingual texts, but in mixed texts (glossaries, texts with embedded quotations or notes in other languages etc etc) I find I sometimes need to force the spelling checking one way, and then another.

My case may be a bit of an outlier though. macOS installation dialogs etc seem to make unstable decisions about which language to use on my system.

Can you make sense of this API in the “Configuring Spell Checkers Languages”.

https://developer.apple.com/documentation/appkit/nsspellchecker

In particular:

  • automaticallyIdentifiesLanguages
  • language()
  • setLanguage(_)

What confused me is that all the macOS UI has a list like:

  • Automatically Identifies Languages
  • Language 1
  • Language 2
  • Language 3

When user selects “Language 1” am I supposed to set automaticallyIdentifiesLanguages to false? And when use selects “Automatically Identifies Languages” I will set language to whatever is default language in local?

It wasn’t clear, and that got me wondering if anyone uses it in the first place. Second I guess you can control all those from System Preferences. Does it make sense to show this in UI? (I do have all the code in place so not extra work, I’m just no 100% sure I’m using API right and didn’t seem many people used it, so that’s why I left out.

Thanks!

I think so.

And when the user selects “Automatically Identifies Languages” I will set language to whatever is default language in local?

My impression is a bit different there.

I think that automaticallyIdentifiesLanguages

  1. Applies a sniffer function to the text (most probable language based on words found), and
  2. overrides the default language