leocb / MaterialSkin

Theming .NET WinForms, C# or VB.Net, to Google's Material Design Principles.
MIT License
438 stars 132 forks source link

ContextualMenu translation #250

Open valimaties opened 2 years ago

valimaties commented 2 years ago

Hi. Please add a visual struct for Cut, Copy, etc, to be able to change the display Text of ContextMenuStrip in different languages in Design. Thanks.

Edit: My application has all texts in my native language. It is strange to display ContextMenuStrip in English. Suggestion: Change definition of BaseTextBoxContextMenuStrip class from BaseTextBox.cs, change MaterialToolStripMenuItem { Text = "..." }; to MaterialToolStripMenuItem { Name = "..." }; . Now, the method ContextMenuStripOnItemClickStart from MaterialTextBox2.cs must use toolStripItemClickedEventArgs.ClickedItem.Name instead of toolStripItemClickedEventArgs.ClickedItem.Text . Till here I've made modification, but I'm not so experienced, I don't know how to add that struct in MaterialTextBox file to be able to modify it in Design and in the same time to assign values from that struct to MenuStripItems Text property.

valimaties commented 2 years ago

I managed to make it work. The converter I used is made by Reza Aghaei, in this solution on stackoverflow.com

ContextualMenu

as you can see, Undo and Select All are in english, because was not changed in ContextMenuTranslation struct property ContextualMenu2

I will make a PR for this.

valimaties commented 2 years ago

I've did it this way: ChangedContextMenuLanguage

But, I have some problems with text width in ContextMenuItem. I think I have to make some modifications on OnRenderItemText of MaterialContextMenuStrip class. If you @orapps44 know how to change the size of each element, and what must be exactly modifying, please help me with the code...

valimaties commented 2 years ago

ContextMenu Translation made. You can review it and if it is ok for you, you can merge PR. Thanks.