Context Menu Language

WinForms

ComponentOne's WinForms controls

Context Menu Language

  • rated by 0 users
  • This post has 4 Replies |
  • 2 Followers
  • Hi,

    I´m using ComponentOne SpellChecker for .NET (2.0).

    I´ve changed DialogLanguage property to Portuguese.

    All labels in spell dialog box were changed to Portuguese.

    However, labels in menu context are still in English.

    I´d like to translate them to Portuguese.

    How can I do it?

    Thanks. 

  • Oops, looks like that should be done automatically. I made a note to automate the localization of the context menu in a future version. Thanks for bringing that up.

    In the meantime, the code below shows how you can customize the spelling context menu (to localize, or change the menu items in any way you like):

    public Form1()
    {
      InitializeComponent();

      // get notified when the context menu changes
      this.textBox1.ContextMenuStripChanged += new EventHandler(textBox1_ContextMenuStripChanged);
    }
    void textBox1_ContextMenuStripChanged(object sender, EventArgs e)
    {
      if (this.textBox1.ContextMenuStrip != null)
      {
        // get notified when the menu is about to open
        this.textBox1.ContextMenuStrip.Opening += new CancelEventHandler(ContextMenuStrip_Opening);
      }
    }

    // translate spell menu to Portuguese
    void ContextMenuStrip_Opening(object sender, CancelEventArgs e)
    {
      ContextMenuStrip menu = sender as ContextMenuStrip;
      foreach (ToolStripItem item in menu.Items)
      {
        switch (item.Text)
        {
          case "(no spelling suggestions)":
            item.Text =
    "(sem sugestões)";
           
    break;
          case "&Ignore All":
            item.Text =
    "&Ignorar todas as ocorrências";
            break;
          case "&Add to Dictionary":
            item.Text =
    "&Adicionar ao dicionário";
            break;
          case "&Spell":
            item.Text =
    "&Corrigir ortografia";
            break;
        }
      }
    }

    I hope this helps.

  • BTW, I just noticed that the ContextMenuChanged event doesn't seem to fire for the RichTextBox control. In this case, I suggest attaching a handler to the MouseDown event, checking that the Right button was pressed and getting the ContextMenu at that point instead.

    This method is a little less elegant, but works for both types of TextBox.

  • Hi,

    I have updated my SpellChecker to Version 2.0.20083.26 but I can't find any option to change the ContextMenu language.

    In the Version History for Version 2.0.20083.24 you write:

    Extended the Options.DialogLanguage property to modify the spelling context menu in addition to the spell dialog.

     

    Where/How can I do that?

  • screenshot.jpg

    Just set the C1SpellChecker.Options.DialogLanguage to the language you want to use. This will affect the built-in spell dialog and the context menu. For example:

      this.c1SpellChecker1.Options.DialogLanguage = C1.Win.C1SpellChecker.DialogLanguage.German;

      this.c1SpellChecker1.Options.DialogLanguage = C1.Win.C1SpellChecker.DialogLanguage.Portuguese;

    These lines of code result in context menus in the desired language (screenshot attached).


Page 1 of 1 (5 items)