Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I translate MFC message boxes

Tags:

visual-c++

mfc

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.

like image 506
David Thornley Avatar asked Mar 02 '09 18:03

David Thornley


1 Answers

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.

like image 134
Brian R. Bondy Avatar answered Sep 21 '22 01:09

Brian R. Bondy