TX Spell .NET for WPF

Dictionaries Not Found

Topic

TX Spell .NET reads its language data from four folders: Dictionaries for spell checking, HyphenationLists for hyphenation, SynonymLists for synonyms and LanguageRecognition for detecting the language of a text. When a folder or a file can't be found, TX Spell .NET reports it, or checks text in another language than you expect. The messages below are those of TX Spell .NET 11.0. Installing Dictionaries and Language Data explains where the data belongs.

TX Spell .NET Doesn't Find the Dictionaries Folder

An exception reports that a folder of the language data is missing, with a message such as:

Neither a Dictionaries directory was found inside the application's executable program file folder, nor a valid TXSpell registry key referring to the corresponding default directory could be detected.

The message exists for each folder, and some variants add the path that was searched. A shorter message names the folder only:

The default 'Dictionaries' directory does not exist.

By default, TX Spell .NET looks for each folder next to the application's executable and, on a development machine, below the \Assembly folder of the installation; Where the Spell Checker Looks explains the default. The message means that neither place has the folder.

  1. In a .NET 8 or later project, install the TX Spell .NET package. It copies the four folders into the output directory when you build.
  2. Without the package, copy the folders Dictionaries, HyphenationLists, LanguageRecognition and SynonymLists from the \Assembly folder of the installation into the folder of the executable.
  3. To keep the language data elsewhere, set the folder properties of TXSpellChecker or TXSpell to the folders, as the same page shows.

A Folder You Set Doesn't Exist

An exception reports a path that doesn't exist:

The specified path refers to a directory that does not exist:

The message is followed by the path. A folder property is set to a folder that isn't there.

  1. Check the path you set, and create the folder or correct the path.
  2. Copy the language data into the folder.

A Dictionary File Is Rejected

Adding a HyphenationList to HyphenationLists or a SynonymList to SynonymLists throws an ArgumentException, with the message "File does not exist:" and the path, or "Dictionary type is not valid.". The constructors don't check the file: Add does. An OpenOfficeDictionary or a UserDictionary needs a file that follows a pattern as well.

The file doesn't exist, or its name doesn't follow the pattern of its kind. A file name without a path is looked for in the default folder of its kind.

ClassThe file name
OpenOfficeDictionaryEnds with .dic or .aff; the file is looked for in the Dictionaries folder
UserDictionaryEnds with .txd; the file must be a valid user dictionary
HyphenationListStarts with hyph_ and ends with .dic; the file is looked for in the HyphenationLists folder
SynonymListStarts with th_ or thes_ and ends with .dat or .idx; the file is looked for in the SynonymLists folder
  1. Check that the file name follows the pattern of the table.
  2. Pass the full path of the file, or put the file into the default folder of its kind.

Text Is Checked in the Wrong Language

Words of your language are marked as misspelled, or English is used although the application runs in another language.

The packages and the setup contain the language data for US English only. With the default value "(Auto)" of the Language property, TX Spell .NET falls back to US English when the folder has no dictionary of the application's language; Which Dictionary Is Loaded First gives the order.

  1. Install the dictionaries of your language, as Install a Dictionary describes.
  2. Leave Language at "(Auto)", or set it to the file name of the dictionary, such as de_DE_frami.dic.

Words Aren't Hyphenated or No Synonyms Are Found

Hyphenation doesn't work, or the thesaurus finds no synonyms, while spell checking works.

Hyphenation and synonyms have their own files in the folders HyphenationLists and SynonymLists, and not every archive contains a hyphenation list or a synonym list. When the folder has no list for the language, HyphenationLanguage is "(none)"; SynonymLanguage falls back to a list of another language.

  1. Copy the hyphenation list, hyph_ followed by the language and .dic, into HyphenationLists.
  2. Copy the synonym list, the .dat and .idx files starting with th_ or thes_, into SynonymLists.
  3. Check HyphenationLanguage and SynonymLanguage after the application has started.

How a List Is Chosen for hyphenation and How a List Is Chosen for synonyms describe the defaults.

The Language of a Text Isn't Detected

Detecting the languages of a text with DetectLanguageScopes fails or finds no languages.

Language detection needs the file languageRecognition.resources in the folder LanguageRecognition.

  1. Deploy the folder LanguageRecognition with the file, as the first section describes.
  2. Check LanguageRecognitionDirectoryPath if you keep the folder elsewhere.

See Language Detection.

A User Dictionary Isn't Saved

UserDictionary.Save returns false, or the words users added are gone after a restart.

Save has no effect if the path doesn't end with .txd. It returns false when the dictionary couldn't be saved. A file name without a path is saved in the default dictionaries folder, which users may not be allowed to write to.

  1. Save to a path that ends with .txd, in a folder the user can write to.
  2. Check the return value of Save.

User Dictionaries describes them.