Merge pull request #1145 from mbilker/fix-linux-spellchecker

Fix logic for en_US default dictionary on Linux
This commit is contained in:
Evan Morikawa 2016-01-29 10:16:20 -08:00
commit 87a1fc6d29

View file

@ -12,7 +12,7 @@ class NylasSpellchecker
isLanguageAvailable: (lang) =>
return false unless lang
dicts = @getAvailableDictionaries()
return (lang in dicts) or (lang.split(/[-_]/)[0] in dicts)
return (lang in dicts) or (lang.split(/[-_]/)[0] in dicts) or (lang.replace('_', '-') in dicts) or (lang.replace('-', '_') in dicts)
isSpelledCorrectly: (args...) => not @isMisspelled(args...)
@ -76,7 +76,7 @@ class NylasSpellchecker
getAvailableDictionaries: ->
if process.platform is 'linux'
arr = spellchecker.getAvailableDictionaries()
if not "en_US" in arr
if "en_US" not in arr
arr.push('en_US') # Installed by default in node-spellchecker's vendor directory
arr
else