1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Changing spellchecker language accordingly to current localization

Changing spellchecker language accordingly to current localization

2 posts, 0 answered
  1. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    01 Jun 2010
    Link to this post
    Is it possible to change the RadSpellChecker accordingly to the current localization?

    If my admin is working with portuguese I want the spellchecker to check in portuguese, if it's english I want the spellchecker to check in english and so on, how can I do it?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    01 Jun 2010
    Link to this post
    Hi Bruno Michels,

    Subscribe for OnPreRender event of the control where you have RadEditor declaration. Get the SpellCheckerLanguage list and add or remove the spellchecker language depending on the current culture

    sample code is provided below.

    protected override void OnPreRender(EventArgs e)
       {
           base.OnPreRender(e);
           var cultureName=  System.Threading.Thread.CurrentThread.CurrentUICulture.Name;
           if (cultureName == "en")
           {
               SpellCheckerLanguage lang = new SpellCheckerLanguage("en-US", "US");
               SpellCheckerLanguageCollection collection = textEditor.Languages;
               System.Collections.Generic.IList<SpellCheckerLanguage> newList = new System.Collections.Generic.List<SpellCheckerLanguage>();
               foreach (SpellCheckerLanguage l in collection)
               {
                   if (l.Code == "en-US")
                   {
                       newList.Add(l);
                   }
               }
               if (newList.Count > 0)
               {
                   textEditor.Languages.Clear();
                   foreach (SpellCheckerLanguage scl in newList)
                   {
     
                       textEditor.Languages.Add(scl);
                   }
               }
           }
       }


    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered