Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Made the misconfiguration notice a warning and added suggestions on h…
Browse files Browse the repository at this point in the history
…ow to fix it.

* `README.md`: Added details on how to install new dictionaries.
* Simplified the warning message:
    * Moved the list of search paths into the console only.
    * Changed the notice to look at the settings page.
    * Added a link to the settings page from the dialog.
    * Indicated when system dictionaries were being used.
  • Loading branch information
dmoonfire committed Jun 26, 2018
1 parent c78d05f commit e0ec2ca
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 5 deletions.
49 changes: 48 additions & 1 deletion README.md
Expand Up @@ -21,7 +21,54 @@ To enable _Spell Check_ for your current file type: put your cursor in the file,

To change the language of the dictionary, set the "Locales" configuration option to the IETF tag (en-US, fr-FR, etc). More than one language can be used, simply separate them by commas.

For Windows 8 and 10, this package uses the Windows spell checker, so you must install the language using the regional settings before the language can be chosen inside Atom. Otherwise you can set the `SPELLCHECKER_PREFER_HUNSPELL` environment variable to request the use of the built-in hunspell spell checking library.
### Missing Languages

This plugin uses the existing system dictionaries. If a locale is selected that is not installed, a warning will pop up when a document that would be spell-checked is loaded. To disable this, either remove the incorrect language from the "Locales" configuration or clear the check on "Use Locales" to disable it entirely.

To get the search paths used to look for a dictionary, make sure the "Notices Mode" is set to "console" or "both", then reload Atom. The developer's console will have the directory list.

#### Windows 8 and Higher

For Windows 8 and 10, this package uses the Windows spell checker, so you must install the language using the regional settings before the language can be chosen inside Atom.

![Windows 10 Language and Regions](docs/windows-10-language-settings.jpg)

Once the additional language is added, Atom will need to be restarted.

You can set the `SPELLCHECKER_PREFER_HUNSPELL` environment variable to request the use of the built-in hunspell spell checking library instead of the system dictionaries. If the environment variable is not set, then the `en-US` dictionaries found in the Atom's installation directory will not be used.

### Debian, Ubuntu, and Mint

On Ubuntu, installing "Language Support" may solve problems with the dictionaries. For other distributions (or if Language Support doesn't work), you may use `apt` to install the dictionaries.

```
sudo apt-get install hunspell-en-gb
sudo apt-get install myspell-en-gb
```

You can get a list of currently installed languages with:

```
/usr/bin/hunspell -D
```

Atom may require a restart to pick up newly installed dictionaries.

### Arch Linux

A language may be installed by running:

```
pacman -S hunspell-en_GB
```

For the time being, a soft link may be required if the dictionary provided is "large".

```
cd /usr/share/hunspell
sudo ln -s en_GB-large.dic en_GB.dic
sudo ln -s en_GB-large.aff en_GB.aff
```

## Plugins

Expand Down
Binary file added docs/windows-10-language-settings.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 24 additions & 4 deletions lib/system-checker.coffee
Expand Up @@ -82,14 +82,34 @@ class SystemChecker
# If we fell through all the if blocks, then we couldn't load the dictionary.
@enabled = false
@reason = "Cannot load the system dictionary for `" + @locale + "`."
message = @reason \
+ " Checked the following paths for dictionary files:\n* " \
message = "The package `spell-check` cannot load the " \
+ "system dictionary for `" \
+ @locale + "`." \
+ " See the settings for ways of changing the languages used, " \
+ " resolving missing dictionaries, or hiding this warning."

searches = "\n\nThe plugin checked the following paths for dictionary files:\n* " \
+ searchPaths.join("\n* ")

if /(win32|darwin)/.test process.platform and not process.env.SPELLCHECKER_PREFER_HUNSPELL
searches = "\n\nThe plugin tried to use the system dictionaries to find the locale."

noticesMode = atom.config.get('spell-check.noticesMode')

if noticesMode is "console" or noticesMode is "both"
console.log @getId(), message
console.log @getId(), (message + searches)
if noticesMode is "popup" or noticesMode is "both"
atom.notifications.addError message
atom.notifications.addWarning(
message,
{
buttons: [
{
className: "btn",
onDidClick: -> atom.workspace.open("atom://config/packages/spell-check"),
text: "Settings"
}
]
}
)

module.exports = SystemChecker

0 comments on commit e0ec2ca

Please sign in to comment.