EDIT: Although useful, the "duplicate" question does not give an answer to this question. First, the main theme here is Menus, so please don't mark this question duplicate to a question that is not.
I have been trying to understand correctly how to localize an application.
Right now I have a form with a label, a menu and a listbox.
I have localized the form so that now I have three resx
files.
I used Z.R.T. answer to implement the listbox to change the language on runtime. Instead of his implementation of ApplyLocalization
I used
public void ApplyLocalization(CultureInfo ci)
{
//button1.Text = Properties.Resources.button;
ComponentResourceManager componentResourceManager = new ComponentResourceManager(this.GetType());
foreach (Control c in this.Controls)
{
componentResourceManager.ApplyResources(c, c.Name, ci);
}
}
With that I can succesfully translate the label only.
Debugging the process I can see that there are three Controls: (The listbox, the label and the menu). For the listbox ApplyResources do nothing. For the label it does change the language of the label. The problem is for the menu. When c
is the menuStrip, ApplyResources
only applies it to the menuStrip, but not the menu options that are the ones that needs to be translated. (Actually the same thing happens to the listbox since the contents of the listbox are not translated either)
My question is how can I apply the resources to the internals (submenus) of a menu so that the menu contents also gets translated?