Spell Check Plugin
==================

.. contents::


About
-----
This plugin checks the content of the current document in Geany with the spell
check library Enchant. You can also select a certain text passage, then the
plugin will only check the selected text. All lines with misspelled words
are highlighted with a red squiggly underline and the wrong words are printed
in the messages window at the bottom of Geany together with available
suggestions. For the plugin to work at all, you need to have the Enchant
library installed together with at least one backend (Aspell, Myspell,
Hunspell, ...).
The plugin's configure dialog lists all available languages/dictionaries
which can be used for the spell check.


Features
--------

* Check spelling while typing
* Highlight spelling mistakes
* Editor-menu integration


Usage
-----
Install the plugin (https://plugins.geany.org/install.html) then
load it in Geany's plugin manager. A new menu item in the Tools menu
will appear. Alternatively, you can assign a keyboard shortcut in
Geany's preferences dialog to perform a spell check.


Configuring custom dictionaries
-------------------------------
Especially on Windows, you might need to install the dictionaries (the files
containing the information for spell checking) manually.
First, you need to download the dictionary files for the
languages you want, e.g. from
https://cgit.freedesktop.org/libreoffice/dictionaries/tree/ or
https://addons.mozilla.org/en-US/firefox/language-tools/.
The downloaded archives should contain one or more .dic and .aff files.

Instructions:

1. Download the archive you want to use
2. The downloaded archive with extensions like .xpi or .oxt is actually a ZIP
   archive, so extract it as usual (e.g. with 7-Zip or another ZIP
   unpacker). Extract the contents into a folder of your choice,
   e.g. `C:\\dictionaries`
3. If the extracted dictionary files contain hyphens ("-"), replace them
   with underscores
4. Then open to the Spell Check plugin preferences dialog in Geany and
   choose the folder you just created. You may need to restart Geany
   and then the installed dictionaries should be available

Note: if you are using Enchant 2.0 or later (the library used by the SpellCheck
plugin), you need to move the dictionaries into a subfolder called "hunspell"
in the directory you created above. The directory to be configured in the
plugin's configuration dialog still is the directory above that folder.
To check which Enchant version you are using, check "Help->Debug Messages" in
Geany and find the appropriate log message telling about the Enchant version.

Example::

    C:\
    ├── dictionaries
    │   └── hunspell
    │       ├── ca_ES.aff
    │       ├── ca_ES.dic
    │       ├── cs.dic
    │       ├── cs.dic
    │       ├── de_DE_frami.aff
    │       ├── de_DE_frami.dic
    │       ├── en_GB.aff
    │       └── en_GB.dic
    └── ...

Then in the plugin configuration dialog set the dictionary for
dictionary files to: `C:\\dictionaries`.


Maintaining personal dictionaries
---------------------------------
When you manually add words to your personal dictionary
(using the "Add <word> to Dictionary" menu item), those words are stored
in a personal dictionary per language.
If you want to add, modify or remove words from these dictionaries,
you need to open the dictionaries with an editor like Geany and edit them.
As far as we know, there is no graphical tool to edit those files. However,
they are plain text files with one word per line.

These files are usually located in:
`/home/<username>/.config/enchant/<LANG>.dic`.
The exact storage location might differ between operating systems.

Additional informationcan be found on https://github.com/AbiWord/enchant,
section "Sharing personal word lists between spell-checkers".


Known issues
------------
* Spell checking with some languages like Hindi might be incorrect, i.e. some
  words are incorrectly marked as correctly spelled or marked incorrectly
  as misspelled.
* Crashes of Geany when loading the Spell Check plugin after it was unloaded.
  This can happen when you are using a dictionary from the Zemberek provider
  of Enchant (mostly Turkish dictionaries).
  It can also happen when you tried to use a non-existing
  dictionary and the Zemberek provider is installed on your system.
  To avoid these crashes you have the following options:

  * Do not load the plugin after it was unloaded, restart Geany first
  * Do not use any of the dictionaries provided by the Zemberek provider
  * Update your Enchant version at least to 1.4.3 (once it is released)
  * Uninstall the Zemberek provider

  Background:
             These crashes are all related to the Zemberek provider in Enchant.
             In version 1.4.2 and prior of Enchant, this provider/backend always
             claimed to support any given invalid dictionary name and so it was
             active and caused these crashes on load after unload of the plugin.
             This provider is DBus-based and uses the GObject type
             registration system which is not really capable of being unloaded and
             loaded again.


Requirements
------------

* GTK >= 2.8.0
* Geany >= 0.21


Ideas, questions, patches and bug reports
-----------------------------------------
Send it to me at enrico(dot)troeger(at)uvena(dot)de
or report them at https://github.com/geany/geany-plugins/issues.
