Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add language to NSSpellChecker's available languages?

Currently, a call to

println(NSSpellChecker.sharedSpellChecker().availableLanguages)

prints out this list of languages:

[en_GB, en, en_AU, en_CA, en_IN, da, de, es, fr, it, nl, nb, pt_BR, pt_PT, sv, tr, ru]

I need to work with 2 more, so I followed the answer here and successfully added these 2 languages to my mac's spell checker. So yes, I have now system wide spell checking in these to aditional languages. And they show in available spell check languages as well as show on following screenshot - first language Slovenčina is new (it's code is sk):

enter image description here

Unfortunatelly, NSSpellChecker seems to not have registered these new languages as they are not listed as available. List of available languages is unchanged, as shown above.

Is there a way to make NSSpellChecker work with these added languages?

like image 999
Rasto Avatar asked Jul 03 '15 22:07

Rasto


1 Answers

It seems like the NSSpellChecker class has some bugs in it. There already was a discussion about a bug with custom NSSpellChecker servers back in 2008 (which was fixed few months later).

At the moment I suggest you to file a bugreport since your code is correct as the documentation and the compiler says.


Update

There are lots of other bugs regarding the NSSpellChecker class, so it doesn't surprise me, that you just found another one.

  • Automatic language detection
  • Unexpected return value in countWordsInString:language:
  • Crashing application due to NSSpellCheckerCheckString

Buggy NSSpellChecker it seems...

like image 74
Fabio Poloni Avatar answered Nov 13 '22 17:11

Fabio Poloni