tags:

views:

349

answers:

2

I'm localizing an MFC app into Japanese, and have the resources working right.

My current problem is that, when I use AfxMessageBox, or MessageBox, the dialog title and button messages come up in English, and I haven't found anywhere to change that.

I haven't found anything useful searching MSDN or Google.

So,

Does this work? Does Windows come up with "OK" or "Yes/No" buttons in Japanese, Arabic, and Russian?

If not, what do I specify to change these?

Edit: I went with MessageBoxEx, writing a wrapper class to make it as convenient to use as AfxMessageBox. It does appear that MB_OK comes up as "OK" in both English and Japanese, but other button options like MB_YESNO are translated into something that I assume is correct Japanese. This was a fairly small application to translate, and we might want to use something automated for the larger ones.

+1  A: 

Use MessageBoxEx and specify the WORD wLanguageId field.

wLanguageId [in] Specifies the language for the text displayed in the message box button(s). Specifying a value of zero (0) indicates to display the button text in the default system language. If this parameter is MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), the current language associated with the calling thread is used.

To specify a language other than the current language, use the MAKELANGID macro to create this parameter. For more information, see MAKELANGID.

More information on MAKELANGID can be found here.


If this does not work well for you, the alternative would be to make your own dialog box.

Brian R. Bondy
A: 

The title is a string you specify, so you should be able to translate it. In AfxMessageBox(), the title is the application name (AfxGetAppName() IIRC).

Regarding the buttons, the text is part of the OS and cannot be translated.

MessageBoxEx (mentioned by Brian) never worked well regarding languages support. This MS KB article from over a decade ago says the language id will be correctly supported by Windows 2000. But it obviously never made it through.

So you're pretty much out of luck. Your only solution would be to use a 3rd party implementation such as the excellent XMessageBox and provide translations through your string table.

Note that appTranslator's glossary contains words such as Yes, no, cancel,... in 25 languages and would translate them automatically.

Serge - appTranslator
FWIW, MessageBoxEx did the trick nicely in my case.
David Thornley