Krunner's spellcheck plugin has been pretty broken since=
bd291d21f096a714a171e7af3a534ba345ca5659 (about two years ago) because it =
called Sonnet::Speller::setLanguage every time the spellchecker was invoked=
, which was (very much) not thread-safe. =
Review 106242 fixes the segfaults, this commit fixes the feature, which I u=
nderstand to be, basically, the =
ability to type 'spell french bonjour' and have it check the spelli=
ng.
The current code simply calls setLanguage on the second term in the search =
query, and then checks whether the resulting dictionary object is valid. Un=
fortunately, the response of the spell-checker to being fed an invalid lang=
uage was to crash on the next query (this is fixed in 106242). Furthermore,=
the spell-checker expected languages like 'fr_FR' or 'French (=
France)' which the user was vanishingly unlikely to type in correctly. =
So what this does is to only call setLanguage when necessary (just in case =
I missed something in 106242), =
and then only after we have turned the query we are fed into a valid spell-=
checker language. =
This is a little bit tricky, because in particular "spell english"=
; is going to mean different things to different people. =
My approach was to try and find the main language of the group: so 'fre=
nch' gets you fr_FR. This works ok for most things, but not really for =
english. For that I default to US english, unless UK english is installed. =
Probably one should special case other english variants as well, but I have=
n't because I am unsure what spellings are in common use in practice. =
I have not tested this spelling an asian language as I don't speak one.
I have not implemented 'spell canadian french' or similar. If you w=
ant a specific sublanguage you have to type in the language code directly.
|