Re: Internationalizing Delphi-compiled applications

Posted by webmaster Guido on March 20, 2006

In Reply to Internationalizing Delphi-compiled applications posted by Phil p12436 on March 14, 2006:

Has anyone had experience of writing a multi-language Delphi application? I have just started using Delphi5 Enterprise (because the original code I am working on was written in Delphi 5 Professional) and I see the ITE and Translation Manager, so I can understand the concepts of that. However, when checking the Translation Manager it does not seem to find all the Delphi pop-up boxes, like Confirm? Yes No Cancel etc. etc.

[...] But, just those Dephi-specific boxes always pop up in English!

The strings you are looking for, are in PAS (unit) files with the word "consts" in the file name, in the $(DELPHI)\Source\VCL folder. For example, in CONSTS.PAS:

  SMsgDlgWarning = 'Warning';
  SMsgDlgError = 'Error';
  SMsgDlgInformation = 'Information';
  SMsgDlgConfirm = 'Confirm';
  SMsgDlgYes = '&Yes';
  SMsgDlgNo = '&No';
  SMsgDlgOK = 'OK';
  SMsgDlgCancel = 'Cancel';

The constants above are for the MessageDlg function.
Likewise, in the VDBConsts.pas unit, there are values like 'Delete record', and so on. Some other units: ADOConsts, DBConsts, BDEConsts, VDBConsts, IBXConsts, and so on...

How to safely change those string constants? Example: translate the button captions displayed by the ShowMessage / MessageDlg functions:

1. Copy Consts.pas to your projects folder (do NOT change code in the original VCL folder).

2. Translate the strings in this copy of the file. Note: if a string contains something like #d or #s be sure not change the #d or #s, because they are used in formatted message boxes - when a message box displays a string value plus some more info passed with it.

Let us know if you have problems.
Good luck!

Related Articles and Replies