The RadSpell control for ASP.NET Ajax allows you to provide your users with spellchecking in your ASP.NET Ajax applications. The control can be used to spellcheck any server or client editable element which means that any textbox, div, or iframe can be spell checked. Out of the box only three languages are supported by RadSpell; English, French and German. However, we have an offering of several languages that can be downloaded, found in this forum thread, which can be used with RadSpell. These files may be incomplete since they are not officially supported by Telerik, but overall they do provide very solid dictionaries for the various languages listed.
If you look over the list of dictionaries in the above forum thread and do not find the particular language (or languages) that you need does that mean you’re out of luck? Quite the opposite actually, since the Dictionary Configurator application exists and it allows you to define your own dictionaries, as well as edit existing ones! You can find a copy of this application via the “Source Code” link at the bottom of this post.
If you are starting completely from scratch then you might be wondering where to get started. Well the easiest way is to just create a file with words you can think of, or perhaps if you have another dictionary file you can parse it to generate one that is compatible with RadSpell. The format that we have for our dictionaries is simply one word per line without any extra white spaces before or after the word. Once you have this file generated you can open up the Dictionary Configurator and start editing your dictionary!
If you've opened a .tdf file previously you will have seen lines like "test:TST:TST". The two strings following the word test are simply the phonetics of the word before it. The Dictionary Configurator actually takes care of adding these to words when you import a file, so while Test.tdf only has a few words (no phonetics included) once you import it to the Dictionary Configurator it will look a bit different. Running these files through the configurator will allow you to provide RadSpell with a fully compatible dictionary.
For testing purposes I have included two additional files with the Dictionary Configurator: "Test.tdf" and "Wordlist.txt". The Test.tdf file simply has a few words listed in it to show what a custom dictionary might look like. Once you start the Dictionary Configurator you can see the following screen which allows you to import dictionary files, edit dictionary files and see the dictionaries that are available to you (populated from the contents of the RadSpell folder in App_Data).
If you browse for the Test.tdf file on your local machine and then press “Import” you will see that the "Available Dictionaries" list has been updated to include Test.tdf. Now if you select the “Edit dictionary page” you will see the following interface:
Here you can select the dictionary you are interested in editing (in this case Test.tdf) and there are a few things you can do once your dictionary is selected. The first thing to note is that you can search for words in your dictionary to A) see if they exist in your dictionary and B) remove any words that you do not want in your dictionary. You can also import a word list (which is what Wordlist.txt is for!) which is simply a list formatted just like the dictionary but it will insert all of the words in the list into the selected dictionary. Finally you can simply type in a word and add it to the dictionary. A note I’d like to make here is that you can also add words to RadSpell when you have actually implemented it, so you do not need to go through the configurator just to add words. Of course, removing words from the dictionary can be best handled by the configurator (just in case words have been accidently added).
Now how do you actually set up RadSpell to use this new dictionary? Well that is fairly easy and all you have to do is set the “DictionaryLanguage” property just like below:
>Tezt thiiis textt</
Now you are using your custom dictionary with your RadSpell control on all of your ASP.NET Ajax pages! If you are curious as to how to use the RadSpell control in general here is a link to our online demos which show off the capability of the control.
As I mentioned previously I have attached the source code to the Dictionary Configurator below. Just add your local reference to Telerik.Web.UI and you will be ready to create your own dictionaries!
Iana Tsolova is Product Manager at Telerik’s DevTools division. She joined the company back in the beginning of 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of the ASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web development, reading articles related to geography, wild nature and latest renewable energy technologies.