Welcome Guest Search | Active Topics | Sign In | Register

SpellChecker Dictionary File does not exist Options
Rob
Posted: Monday, September 28, 2009 8:29:10 AM
Rank: Newbie
Groups: Member

Joined: 9/23/2009
Posts: 8
I am using the spellchecker and I notice that when I set my browser's language to a language that does not have a dictionary, my web site crashes when I start the spell checker. For now, I've added a couple of appSettings to my web.config file that define a default language and the supported languages, as follows.

<add key="DefaultLanguage" value="en-US"/>
<add key="SupportedLanguages" value="en,fr"/>

Then when I create an instance of my spell checker, I perform the following logic.

string[] langs = WebConfigurationManager.AppSettings["SupportedLanguages"].Split(",".ToCharArray());
bool fLangFound = false;
if (langs.Length > 0)
{
string[] browserLangs = Request.UserLanguages;
foreach(string lang in langs)
{
if (browserLangs[0].ToLower().Contains(lang))
{
fLangFound = true;
break;
}
}
}
if (!fLangFound)
spellChecker.Language = WebConfigurationManager.AppSettings["DefaultLanguage"];

Is there a better way?
eo_support
Posted: Monday, September 28, 2009 9:02:28 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Unforunately no. There isn't a better way. The code throws an exception on purpose when the folder doesn't exist so that you will be made aware of that you actually do not have the dictionary files. This avoid situation where everybody though it's working but actually it is not.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.