This is a migrated thread and some comments may be shown as answers.

Spellcheck

1 Answer 65 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Pablo Tola
Top achievements
Rank 2
Pablo Tola asked on 17 Feb 2011, 11:04 PM
I've been trying to get the editor to load a different language for spellcheck, I have the tdf files saved as resources in my assembly.

this is the code:

private void LoadDictionary(string language)
        {
            var res = Properties.Resources.es_ES;
            MemoryStream tdfFileStream = new MemoryStream();
            tdfFileStream.Write(res, 0, res.Length);
            RadDictionary dictionary = new RadDictionary();
            dictionary.Load(tdfFileStream);
            ((DocumentSpellChecker)editor.SpellChecker).AddDictionary(dictionary, CultureInfo.InvariantCulture);
        }

what am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 22 Feb 2011, 09:52 AM
Hello Pablo Tola,
You have most probably referenced the en-us dictionary also. When it is referenced and the current thread culture is set to en-us also, then the en-us dictionary takes precedence over the invariant culture one. What is recommended in your case is to add the dictionary to the es-ES culture instead of the invariant one and change the current thread culture to es-ES. This will ensure a correct behavior. For example:
private void LoadDictionary(string language)
{
    CultureInfo culture = new CultureInfo("es-ES");
    var res = Properties.Resources.es_ES;
    MemoryStream tdfFileStream = new MemoryStream();
    tdfFileStream.Write(res, 0, res.Length);
    RadDictionary dictionary = new RadDictionary();
    dictionary.Load(tdfFileStream);
    ((DocumentSpellChecker)editor.SpellChecker).AddDictionary(dictionary, culture);
    Thread.CurrentThread.CurrentCulture = culture;
}

Don't hesitate to contact us if you have other questions.


Greetings,
Boby
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
RichTextBox
Asked by
Pablo Tola
Top achievements
Rank 2
Answers by
Boby
Telerik team
Share this question
or