-
November 19th, 2009, 10:50 AM
#1
Localization MessageBoxEx
Hi there,
i'm currently trying to localize an application but got problems when the application locale is different from the OS locale.
I'm trying to display a message boxes with the buttons in localized language.
To do so im using the MessageBoxEx function
int MessageBoxEx(
HWND hWnd,
LPCTSTR lpText,
LPCTSTR lpCaption,
UINT uType,
WORD wLanguageId
);
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
For testing i'm using a WindowsXP Pro SP3 machine with an english installation and the french MUI pack installed.
Developing with visual studio 2008 SP1 and windowsSDK 7.0
my function call is the following:
MessageBoxEx(NULL,"mymessage","mytitle",MB_YESNO | MB_ICONWARNING, MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US))
this works out great.
when using english or french as OS language setting my message box shows in english language, complete with the "yes" and "no" buttons
while this
MessageBoxEx(NULL,"monmessage","montitle",MB_YESNO | MB_ICONWARNING, MAKELANGID(LANG_FRENCH,SUBLANG_FRENCH))
is a different story.
when using french language as OS language it shows ok, with "oui" and "non" as button labels
but when using the same executable and english as os language the button labels show as "yes" and "no".
The problem is that im not able to change the language on an english OS language where on the french OS it just works fine.
My application should be independent from the os locale an it should be configurable which language is used.
i tried to google this and found a lot but couldn't find a definitive answer wheter its a problem on my side or it isn't possible to do what i want with MessageBoxEx and i must build my own solution.
can someone please give me a definitive answer?
-
November 20th, 2009, 09:40 AM
#2
Re: Localization MessageBoxEx
Where is the problem? If a user has selected English, in his settings, then it is ok to have "Yes" and "no" instead of "Oui" and "Non", isn't it?
Quel est le problème ? Si un utilisateur choisit l'anglais dans sa configuration, il est normal qu'il ait "Yes" et "No" au lieu de "Oui" et "Non", ne croyez vous pas ?
-
November 20th, 2009, 10:47 AM
#3
Re: Localization MessageBoxEx
Originally Posted by olivthill2
Where is the problem?
The problem, IMHO, is in the fact that MessageBoxEx does not work as it described in MSDN (or, at least not as OP has expected it to work)
Victor Nijegorodov
-
November 20th, 2009, 11:37 AM
#4
Re: Localization MessageBoxEx
According to this, the language id is pretty much ignored: http://blogs.msdn.com/michkap/archiv...01/522164.aspx
So you'll have to stop using MessageBox* if you want to localize just your application (ignoring OS settings).
gg
-
November 24th, 2009, 04:31 AM
#5
Re: Localization MessageBoxEx
Originally Posted by olivthill2
Where is the problem? If a user has selected English, in his settings, then it is ok to have "Yes" and "no" instead of "Oui" and "Non", isn't it?
The problem is that the application language setting can't be set to french when im using the english OS language.
So i guess i won't be able to avoid creating a custom message box to show the language and i will do as suggested and replace all MessageBox* calls.
thx
-
November 24th, 2009, 05:29 AM
#6
Re: Localization MessageBoxEx
Yes, you can customize AfxMessageBox (or ::MessageBox) using CBT hook and change all messagebox button captions according to your needs.
See:
MessageBox with Custom Button Captions
CBT Message Box
Fancy Custom MessageBox
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|