With the release of TinyMCE 5.9, Spell Checker Pro now provides a wider range of languages. It expands the number of languages by incorporating support for Hunspell dictionaries.
What’s Hunspell? Hunspell is a set of dictionaries used for spell checking software. It’s open source, and has an active community of contributors.
Earlier versions of Spell Checker Pro had:
- 15 different dictionaries
- Included Medical English (UK), and Finnish
The new version of Spell Checker Pro, available in TinyMCE 5.9 has:
- 21 different dictionaries
- Includes the new additions of Afrikaans, Australian and Canadian English, Hungarian, Maori, Norwegian Nynorsk, Polish, Brazilian Portuguese, and Swedish (Finland)
Configuring languages with TinyMCE
To add the new Hunspell dictionaries to your rich text editor configuration, add the spellchecker_language
option to your tinymce.init
script. Then you can select specific language codes.
For example, following the supported language list in our documentation, you could configure the following:
tinymce.init({
selector: 'textarea',
plugins: 'tinymcespellchecker',
toolbar: ‘spellchecker’,
spellchecker_language: 'Medical English(US)=en_US-medical, English (Australia)=en_AU, English (Canada)=en_CA, Medical English=en_US-medical, Hungarian=hu, German=de, Spanish=es, Polish=pl, Swedish (Finland)=sv_FI'
});
This will enable the range of languages specified in the comma-separated format (Australian English, Canadian English, US English Medical Dictionary, Hungaira, German, Spanish, Polish, and Swedish-Finland).
Hunspell options for TinyMCE server-side
When you configure the TinyMCE server-side components, include the hunspell-dictionaries-path
configuration in your application file. This is the only method to access the Hunspell dictionaries in your application or website set up. Make sure you include the pathway to the dictionary files ”/opt/ephox/hunspell-dictionaries”
Here’s an example setup:
ephox {
spelling {
hunspell-dictionaries-path: "/opt/ephox/hunspell-dictionaries"
}
}
Place the Hunspell dictionaries in the same directory as your local TinyMCE application configuration file to avoid any errors.
TinyMCE Spell Checker Pro and General Public Licenses
Because of the rules and restrictions of open source licencing, the Hunspell dictionaries won’t appear automatically in a Self-hosted TinyMCE setup. If you have a Self-Hosted TinyMCE subscription, and need to use Hunspell dictionaries in your application or project, a set of dictionaries are available without the GPL or LGPL licencing.
Here’s how to access and configure these dictionary sets:
- Sign up for a self hosted account with TinyMCE to locate the Hunspell dictionaries.
- Navigate to the Downloads Tab.
- Select the zip file named
hunspell-dictionaries-approved.zip
if you do not want a GPL or LGPL dictionary in your project. - Unzip the dictionary file in your local environment.
- Move the languages you want for your project into the project directory using the following structure:
├── <language-initial>
│ ├── language.aff
│ ├── language.dic
│ └──licence (if applicable)
The following is an example using Hungarian, US English - medical, and Maori:
├── hu
│ ├── hu.aff
│ ├── hu.dic
│ └── license
├── en_US-medical
│ ├── en_US-medical.aff
│ ├── en_US-medical.dic
│ └── license
├── mi_NZ
│ ├── license
│ ├── mi_NZ.aff
│ └── mi_NZ.dic
Once you have configured the dictionaries, test out the Spell Checker plugin to make sure it’s working before pushing any changes to your project in production. If your dictionary configuration has an error, TinyMCE will default to using the built-in spelling library.
There is also a set of dictionaries available if the GPL or LGPL licensing controls work for your project. Select the hunspell-dictionaries-all.zip
file instead of the hunspell-dictionaries-approved.zip
in step three from the preceding section. See the TinyMCE documentation for more instructions on configuring the Hunspell dictionaries in a Self-Hosted environment.
What’s next?
You can find out more about setting up the Spell Checker Pro plugin with Hunspell dictionaries with a Self-hosted TinyMCE setup in the TinyMCE documentation.
If you have further questions about how the new Hunspell dictionaries work, reach out to us, and let us know what you need.