Yes/No/Cancel localization?

How can I change mbYes/No/Cancell etc. MessageBox Flags to my national words? -Also, when I'm planning an international version could it be read from Windows?

Who is Participating?
kretzschmarConnect With a Mentor Commented:
just use


the captions will be displayed in the os-language version

meikl ;-)
Perhaps your problem is just the opposite? You are writing a programme that should run in the language it is meant to run rather the language of the version of Windows it is run on?
For example: If your progamme is in French, and it's running on an English release of Windows, if you use messagebox, application.messagebox, showmessage, messagedlg and the like, you will get stuff like:

Etes-vous sure que vous voulez faire ça?
Yes     No   Cancel

Or if your programme is in English and Windows in Spanish:

Are you sure you want to do that?
Sí      No     Cancelar

The answer is simple: if you want Window's language for your buttons, just use this functions.
If you want to be in control of the language of this messages, write your own procedures or functions that create forms with this buttons and labels as needed with the message to be shown, and internationalize (what an ugly word for "translate") the captions in those forms in the same way you are internationalizing all the rest of the application.

Hope it helps:

One more detail:

Bear in mind that, if you want to use the Windows language, then the values in the set of buttons are the same for any language:

if you include mbYes, you won't get a button saying "Yes". You'll get a button saying whatever word means "Yes" in whatever the language of Windows.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


>messagebox, application.messagebox, showmessage, messagedlg

all these functions are providing a caption depending on the language
of the delphi release rather than in the language of the os

using os-caption, u have to use the windows-api, which is
most wrapped the the windows-unit

or as you stated is to define a own form for the dialog

meikl ;-)
JacekHAuthor Commented:
Thanks to all. It seems I have to prepare some forms more :)
I have English WinXP but want to run my programs on Polish and German windows. I have to be sure that users get all this Yes/No/Cancel translated to their Ja/Tak etc. ;) I also found consts.pas unit with those descriptions which I have to experiment with :)

Thanks and regards,
No, Meikl. You're right about MessageDlg and ShowMessage. They use captions for the buttons taken from Delphi (from Consts.pas, actually).
MessageDlg also gets it window title from there.
ShowMessage uses the name of the executable (with the .exe trimmed off) as caption for the form.

But MessageBox and Application.MessageBox take the caption of the form as a parameter and the captions for the buttons from Windows, because MessageBox is a Windows API call and Application.MessageBox is just a wrapper for it.


yep, jack, you're right about messagebox, missed this ;-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.