Spellcheck

2 posts, 0 answers
  1. Pablo Tola
    Pablo Tola avatar
    44 posts
    Member since:
    Nov 2007

    Posted 17 Feb 2011 Link to this post

    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?
  2. Boby
    Admin
    Boby avatar
    763 posts

    Posted 22 Feb 2011 Link to this post

    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!
Back to Top