Open daijie opened 7 years ago
Seeing this on linux as well.
Another example is testt
, it's misspelled of test
.
Always return false except on Mac.
I have changed to a package called hunspell-spellchecker
, slower but works.
I got it working on linux.
Try setting the LANG environment variable.
export LANG='en_US'
Once it is done, you can run your
Thanks,
I have the same issue when using it on Windows 7. Adding the LANG
variable does not change anything.
Any progress on this? :(
I know it is late, but I forced it to work. I did two things - to my webpack build.js file I added process.env.LANG = 'en-UK' variable, and In my app I imported spellchecker and added spellchecker.setDictionary('en-UK'). I do not know which one of these things did the job, but my production build is working as intended. And to do all of that I needed only a few hours of trial and error and a quick look at the source files.
Hey Guys,
I was having the same issues in Linux. I fixed it by adding this:
SpellChecker.setDictionary('en-US',SpellChecker.getDictionaryPath())
Where SpellChecker
is spellchecker imported.
Basically it sets the dictionary, then uses a function to get the path of the hunspell dictionary.
On Mac it was working without this line of code, for some reason the code didn't work on Linux until I manually set the language & dictionary.
On Windows 10 and Mac, this library uses the system libraries to do spell checking. That means you have to look at the system to figure out what the spell-checking isn't working.
Linux doesn't provide that nor does it have standard locations for dictionary files. That means we can't make any assumptions or automatically enable it on Linux without a locale+directory or a specific dictionary file to work with.
The SpellChecker.getDictionaryPath()
sadly only works for en-US
because we package a copy of that library with the package. All other languages aren't provided.
On Windows 10 and Mac, this library uses the system libraries to do spell checking. That means you have to look at the system to figure out what the spell-checking isn't working.
Linux doesn't provide that nor does it have standard locations for dictionary files. That means we can't make any assumptions or automatically enable it on Linux without a locale+directory or a specific dictionary file to work with.
The
SpellChecker.getDictionaryPath()
sadly only works foren-US
because we package a copy of that library with the package. All other languages aren't provided.
Aha - that makes sense now.
Quick question: do you know why results on Mac and Linux might be different, if the dictionary files are the same? I checked the .aff and .dic files with MD5 hash and they're identical, but on Linux the suggested words are often different than on Mac.
Unless you set an environment variable, the Mac completely ignores the dictionary file and uses the operating system one instead. Doesn't even try to open it.
Unless you set an environment variable, the Mac completely ignores the dictionary file and uses the operating system one instead. Doesn't even try to open it.
Ohhhhh that's why. I was banging my head against a wall for a couple hours yesterday trying to figure this out. I'll send an environment variable. Thanks!
You can use https://github.com/Wulf/nodehun in the meanwhile. brew install hunspell
or sudo apt-get install hunspell
. Not sure about Windows support, but it looks like Chocolatey has hunspell package as well.
For example,
mathched
is misspelled formatched
.SpellChecker.isMisspelled
works well on Mac OS X but it always return false on Windows 10.