 
   isSpelledCorrectly: (args...) => not @isMisspelled(args...)
 
-  setLanguage: (lang="") ->
+  setLanguage: (lang="", dict=@_getDictionaryPath()) ->
     @languageAvailable = @isLanguageAvailable(lang)
-    if @languageAvailable
+    if @languageAvailable or process.platform is 'linux'
       spellCheck = @isSpelledCorrectly
     else
       spellCheck = -> true

    if lang.length is 0 then lang = "en-US"

    @_setWebframeSpellchecker(lang, spellCheck)
    spellchecker.setDictionary(lang)

  # Separate method for testing
  _setWebframeSpellchecker: (lang, spellCheck) ->
    require('web-frame').setSpellCheckProvider(lang, false, {spellCheck})

  #### spellchecker methods ####
  setDictionary: (lang) => @setLanguage(lang)

  add: spellchecker.add

  isMisspelled: (text) =>
    if @languageAvailable then spellchecker.isMisspelled(text)
    else return false

  getAvailableDictionaries: ->
    spellchecker.getAvailableDictionaries() ? []

  getCorrectionsForMisspelling: (args...) =>
    if @languageAvailable
      spellchecker.getCorrectionsForMisspelling(args...)
    else return []


path = require('path')

spellchecker = require('spellchecker')

class NylasSpellchecker
