Configuring Spellchecker for TinyMCE

This topic describes how to configure dictionaries for the Episerver Spellchecker for TinyMCE add-on. The add-on comes with a set of predefined dictionaries, and you can add languages.

In this topic

Default language dictionaries

The following dictionaries are included with the add-on by default:

  • Danish (da)
  • German (de)
  • English (en-US)
  • Spanish (es)
  • French (fr)
  • Italian (it)
  • Dutch (nl)
  • Norwegian Bokmål (nb-NO)
  • Norwegian Nynorsk (nn-NO)
  • Polish (pl)
  • Portuguese (pt)
  • Russian (ru)
  • Swedish (sv)

Adding dictionaries

You can add additional dictionaries to the website. You can download dictionary file sources, for example, from OpenOffice Extensions or Mozilla Language Tools. Language packages from these sources are not specifically designed for Spellchecker, but can be extracted and used.

  1. Download the desired language package. Rename the downloaded file to .zip and extract the .aff and .dic files within.
  2. Create a new folder named by language code (for example, en-GB) in the add-on folder \EPiServer.TinyMCESpellChecker\Dictionaries\. Using this path, you can update the add-on without having to add the dictionaries again.
  3. Paste the extracted .aff and .dic files into the newly created folder.

Important notifications

  • For a dictionary to become available for selection in the spellchecker language list, the language must be enabled on the website.
  • The name of the dictionary file should match the language code of the language branch enabled in Episerver. For example, if you enabled en-GB, name your dictionary files en-GB.dic/.aff.
  • Check which language variations your dictionaries cover. A dictionary named en.dic might cover US English, which in Episerver is en-US. While no.dic might cover the Norwegian Bokmål variation, which in Episerver is nb-NO. Most downloadable dictionaries include a README containing this type of information.
  • Only place one dictionary in each language folder to avoid conflicts. For example, do not place both en.dic and en-US.dic in the en folder. 

Using Spellchecker for specific properties

The Spellchecker for TinyMCE is automatically applied to all XHTMLString properties by default, but you can configure your site to use Spellchecker for one or more properties only. For example, if you want to use Spellchecker only for the MainBody of the ProductPage, follow these steps:

  1. Create a class which implements the IConfigurableModule interface.
  2. Implement the class as below:
    [ModuleDependency(typeof(EPiServer.TinyMCESpellChecker.InitializationModule))]
    public class CustomizedTinyMceSpellCheckerInitialization : IConfigurableModule
    {
    	private ServiceConfigurationContext _serviceConfigurationContext;
    	private const string SpellCheckerPluginName = "spellchecker";
    
    	public void Initialize(InitializationEngine context)
    	{
    		_serviceConfigurationContext.Services.Configure<TinyMceConfiguration>(config =>
    		{
    			var defaultSettings = config.Default();
    			var defaultToolbarSettings = defaultSettings["toolbar"] as string[] ?? new string[1];
    
    			// Remove spellchecker from toolbar for default configuration
    			Regex rgx = new Regex($@"\b{SpellCheckerPluginName}\b\s+|\s+\b{SpellCheckerPluginName}\b$");
    			var toolbarWithSpellChecker = defaultToolbarSettings[0];
    			defaultSettings["toolbar"] = rgx.Replace(toolbarWithSpellChecker, "");
    
    			// Apply Spellchecker only for MainBody of ProductPage
    			config.For<ProductPage>(p => p.MainBody)
    				.Toolbar(toolbarWithSpellChecker);
    		});
    	}
    
    	public void Uninitialize(InitializationEngine context)
    	{
    	}
    
    	public void ConfigureContainer(ServiceConfigurationContext context)
    	{
    	_serviceConfigurationContext = context;
    	}
    }

Related topics

Last updated: Apr 16, 2018