Yes/No/Cancel localization?

Posted on 2003-11-08
Last Modified: 2010-04-05
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?

Question by:JacekH
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 27

Accepted Solution

kretzschmar earned 50 total points
ID: 9708080
just use


the captions will be displayed in the os-language version

meikl ;-)

Expert Comment

ID: 9708171
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:


Expert Comment

ID: 9708201
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.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 27

Expert Comment

ID: 9708264

>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 ;-)

Author Comment

ID: 9708461
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,

Expert Comment

ID: 9715228
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.


LVL 27

Expert Comment

ID: 9715323
yep, jack, you're right about messagebox, missed this ;-)

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question