tags:

views:

86

answers:

3

I'd like to have text on buttons of MessageBox to be, say it, in russian, french, etc. - different language than it's set by default in Windows.

Is there any way to do it without creating my custom MessageBoxes?

A: 

Change the Localizable property in your Form to True. Then set the language by changing the Language property.

Ruel
Tried it. No reaction.
26071986
Ok, I found this article here that might help you: http://www.codeproject.com/KB/miscctrl/Localizing_MessageBox.aspx
Ruel
A: 

The System.Windows.Forms.MessageBox is based on the MessageBox function present in user32.dll which uses the current system language to display the text on the buttons. I don't know if there is a way of overriding that, and rolling your own message box looks like the best option available.

devnull
+2  A: 

Avoid spending a lot of time and energy on this. The user of your app will always get the message box she's familiar with. It will show the text that matches her language, much like the rest of Windows. Somebody that speaks Russian as her native language is not going to need to switch to French on the fly. If she actually does then she would have purchased a license for the Ultimate edition of Windows which permits changing the Windows language quickly.

Your app will follow suit, as long as you don't override the default culture and have localized your app. Beware that overriding the default culture of the UI thread is a very dangerous thing to do, the threadpool threads that .NET uses (or you for that matter) still run in the default language. This can cause very subtle problems because of the different string comparison rules. For example, a SortedList filled in one thread will suddenly not be sorted anymore in another thread, causing a binary search to malfunction.

Hans Passant
Thanks, great answer as usual.
26071986