static public void GlobalizeMenuItem(ToolStripMenuItem item) { if (item == null) { return; } if (item.DropDownItems.Count > 0) { item.Text = LocalizedResources.GetResString("MenuHeader." + item.Text.Replace(" ", ""), item.Text); } else { item.Text = LocalizedResources.GetResString("Menu." + item.Text.Replace(" ", ""), item.Text); } for (int i = 0; i < item.DropDownItems.Count; i++) { GlobalizeMenuItem(item.DropDownItems[i] as ToolStripMenuItem); } }
static public void GlobalizeWpfMenuItem(System.Windows.Controls.MenuItem item) { if (item == null) { return; } if (item.Header is string) { if (item.Items.Count > 0) { item.Header = LocalizedResources.GetResString("MenuHeader." + item.Header.ToString().Replace(" ", ""), item.Header.ToString()); } else { item.Header = LocalizedResources.GetResString("Menu." + item.Header.ToString().Replace(" ", ""), item.Header.ToString()); } } for (int i = 0; i < item.Items.Count; i++) { GlobalizeWpfMenuItem(item.Items[i] as System.Windows.Controls.MenuItem); } }