Articles in this section
Category / Section

How to enable WinForms SpellChecker (SpellCheckerAdv) control for different languages based on system configuration?

2 mins read

Enable SpellChecker control

1. The SpellChecker control helps to check the spelling with different languages.

2. Spell check with different languages can be done by getting input language of the system.

3. Input languages can be detected by using InputLanguageChanged event handler.

4. CurrentInputLanguage is used to get the Culture Name by string.

5. Dictionary path can be set by using DictionaryPath properties for the required languages.

6. Custom path can be set by using CustomDictionaryPath for your requirements.

C#

//Detect Input language
void Form1_InputLanguageChanged(object sender, InputLanguageChangedEventArgs e)
{
   MessageBox.Show(e.InputLanguage.Culture.TextInfo.CultureName);
}
private void button1_Click(object sender, EventArgs e)
{
   string str = InputLanguage.CurrentInputLanguage.Culture.TextInfo.CultureName;
   if (str == "en-US")
   {
      this.spellChecker1.DictionaryPath = @"..\..\en_us.dic";
   }
   // To get Spanish language spell check
   else if (str == "es-ES")
   {
      this.spellChecker1.DictionaryPath = @"..\..\Spanish.dic";
   }
   //To get German-Germany language spell check
   else if (str == "de-DE")
   {
      this.spellChecker1.DictionaryPath = @"..\..\Germany.dic";
   }
   // To get Portuguese - Brazil language spell check
   else if (str == "pt-BR")
   {
      this.spellChecker1.DictionaryPath = @"..\..\Brazil.dic";
   }
   this.spellChecker1.SpellCheck(new SpellEditorWrapper(this.richTextBox1));
}

VB

‘Detect Input languagePrivate Sub Form1_InputLanguageChanged(ByVal sender As Object, ByVal e As InputLanguageChangedEventArgs)      MessageBox.Show(e.InputLanguage.Culture.TextInfo.CultureName)End SubPrivate Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
   Dim str As String = InputLanguage.CurrentInputLanguage.Culture.TextInfo.CultureName
      If (str = "en-US") Then
          Me.spellChecker1.DictionaryPath = "..\..\en_us.dic"
      End If
      ‘To get Spanish language spell check
      If (str = "es-ES") Then
          Me.spellChecker1.DictionaryPath = "..\..\Spanish.dic"
      End If
      ’To get German-Germany language spell check
      If (str = "de-DE") Then
          Me.spellChecker1.DictionaryPath = "..\..\Germany.dic"
      End If
      ‘To get Portuguese - Brazil language spell check
      If (str = "pt-BR") Then
          Me.spellChecker1.DictionaryPath = "..\..\Brazil.dic"
      End If
      Me.spellChecker1.SpellCheck(New SpellEditorWrapper(Me.richTextBox1))
  End Sub

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/SpellChecker-1877667165.zip

Conclusion

I hope you enjoyed learning about how to enable WinForms  Spell Checker  control for different languages  in the WinForms Spell Checker.You can refer to our WinForms Spell Checker’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Spell Checker example to understand how to present and manipulate data.  For current customers, you can check out our WinForms controls from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Spell Checker and other WinForms controls. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied