0

I'm maintaining an old Delphi 5 program, built with Delphi 5 Professional German.

The problem is that all dialogs and error messages of the created executable appear in German, even on an English Windows with location set to something like the US or UK.

Do I need the English version of Delphi 5 Pro or is there a configuration option / compiler switch / option to change the "output language"?

I am not talking about the IDE language, I already learned that I can change that back to English by deleting all *.DE files in the Delphi installation directory.

Example:

enter image description here

enter image description here

enter image description here

Update: Based on the comments I went looking for German messages in the Source directory - I immediately found several files:

Source/Rtl/Sys/comconst.pas
Source/Rtl/Sys/sysconst.pas
Source/Rtl/Sys/comconst.pas
Source/Vcl/bdeconst.pas
Source/Vcl/comstrs.pas
Source/Vcl/consts.pas
Source/Vcl/dbconsts.pas
Source/Vcl/ib.pas
Source/Vcl/oleconst.pas

I wish there was an easier way. Don't think I am going down this path...

Reto Höhener
  • 5,419
  • 4
  • 39
  • 79
  • 1
    What you see are string constants probably defined in the `Consts.pas` unit (at least in Delphi 7 it is so). Although I have no clue if it's possible to modify this file and rebuild Delphi 5 VCL. – TLama May 29 '13 at 09:19
  • RTL? Where does the Consts.pas file live? – Reto Höhener May 29 '13 at 09:21
  • 1
    In a sub library from the `source` library of the Delphi5 installation. – LU RD May 29 '13 at 09:23
  • Ok I found the Consts.pas, but I am not seeing all the messages there. I updated my question with more samples. Is there another file? - Edit: Just found it by searching: Source/Rtl/Sys/sysconst.pas. – Reto Höhener May 29 '13 at 09:36
  • @TLama @Zalumon Do not change the RTL source! All those captions are defined not as constants, but as `resourcestring`, so can be changed at runtime, for any language you need. This is the basic of *internationalization*. See my answer. – Arnaud Bouchez May 29 '13 at 09:56
  • 1
    Delphi 5 and 7 were not shipped ith all localisations in the box, like modern ones. So you either have to copy them from some English copy of D5, which may or may not consitute for piracy, gray area to me, or do the translation as suggested. There is no option in compiler to get something out of nothing. Delphi does not have mind of its own to learn languages and do translation. If you cannot find English translation on installation CD, then you either have to do it, or to find it elsewhere. Delphi does not posess a maic hat, to pull the rabbit out of the void. To get l10n some1 has to do it! – Arioch 'The May 29 '13 at 12:41
  • One weird advice would be to get CodeTyphon/Lazarus - perhaps most messages would be the same here with D5 an you would be able to re-use many if not most. – Arioch 'The May 29 '13 at 12:47
  • @Arioch'The Easy, that was exactly my original question: Do I have to buy English Delphi 5 or is it possible to fall back to English with the German version. Looks like I have to get an English version of Delphi 5. – Reto Höhener May 29 '13 at 13:00
  • ...or make a translation yourself, or copy it from some source. Purchasing a Delphi just to get few text lines seems overkill. But... maybe second-hand D5 boxes are cheap now, dunno – Arioch 'The May 29 '13 at 13:21
  • The problem with these files is that I will never be sure if I caught everything. Also I am not quite sure about compatibility issues with the delphi and ADO Express updates. And, I cannot even find the files that contain the QuickReport messages like 'Print', 'Preview', 'Page x of y', etc. – Reto Höhener May 29 '13 at 15:21
  • i think any Delphi localisation suite - there are many - can extract resourcestrings from given pas sources, thus you would be totally sure if you covered them all or not. finding English-localised QR sources can be a problem though... – Arioch 'The May 30 '13 at 09:04
  • @RetoHöhener Did you ever find a solution for this. Im in exactly the same situation with a German Delphi 5 installation and need it to build the output in English. – CathalMF Sep 18 '18 at 13:58

2 Answers2

5

Those text content are defined in unit Consts.pas as resourcestring.

Those resourcestring can be changed on the fly, via some libraries. No need to change the RTL source code!

See this question about localization for a reference.

I recommend GNU Gettext for Delphi which works with your version of Delphi 5, and has a set of pre-translated text of standard Delphi captions for most used languages.

Edit: If you just want to revert back to the English VCL values, there should be the default English .pas and .dcu files in your original Deplhi 5 CD, in the Extra\VCLUS folder. Just overwrite your local files with those. The files are already set in the expected sub-folder layout.

Community
  • 1
  • 1
Arnaud Bouchez
  • 42,305
  • 3
  • 71
  • 159
  • I am not trying to translate to another language, I would like to go back to the default English texts. – Reto Höhener May 29 '13 at 10:03
  • 1
    Then get those *const.pas files from English Delphi and replace German-localised ones, if your program does not use BPLs but a monolithic EXE. Or you may use libraries that can change `resourcestring` in memory on the run. Like VgLib1 or GetText and then add translation of those lines that annoy you. – Arioch 'The May 29 '13 at 10:19
  • If I had an English Delphi, I would just install it and my problem would be solved. I was just wondering if I have to go buy an English Delphi or if it is possible to somehow configure my German Delphi to fall back to English (often internationalized programs have English still around somewhere under the hood). – Reto Höhener May 29 '13 at 11:04
  • Didn't see your edit, I'll look into the CD contents. Edit: I cannot find a directory "Extra\VCLUS" or similar on my Delphi 5 Professional CD. – Reto Höhener May 29 '13 at 11:13
  • The only thing I found was "E:\Runimage\Delphi50\Source\CONSTS.PAS", which contains German messages. – Reto Höhener May 29 '13 at 11:19
  • Arnaud, i scanned out local copy of D7 install CD and did not find there non-English files as well. Though i cannot warrant it is a full dump of CD nor that English-CD has the same files set as non-English-CD. Still i think that prior to latest Delphi releases only one language was shipped. I wonder if ITE was there in D5 and had the default inglish files... one has to search for binary localisation DLLs like VCL5*.en* – Arioch 'The May 29 '13 at 12:45
  • 1
    I got those files from a French original Delphi 5 CD. There is two VCLUS and VCLFR sub-folders. I can send you the files by email - but can not host them somewhere on the net, due to Borland/Embarcadero license. – Arnaud Bouchez May 29 '13 at 12:50
  • Thanks for the offer, arnaud, but I think I will just try to get an English CD. I could not identify the files containing the strings of QuickReport and I also do not feel confident enough to replace all those files without running into stability issues. – Reto Höhener May 29 '13 at 15:23
  • @Zalumon You can just put them into project folder and include into your project as regular files, maybe also `touch` them to have newer dates than stock DCUs. If you make monolithic BPL-less exe that would be enough. Also you can rename them and replace stock constant in memory - a lot of localisation libs or code snippets show how to replace resource-string in memory after EXE loaded – Arioch 'The May 30 '13 at 09:07
1

there are in the bin directory of the tool "BDSSetLang.exe" If you have specified during installation German and English, you can change there the IDE language, library, etc language.

So it should be possible to solve the problem.

OR

Try this.

//...bei einem Message Dialog die Beschriftungen der Buttons ändern
function xMessageDlg(const Msg: string; DlgType : TMsgDlgType;
                     Buttons : TMsgDlgButtons; Captions: array of string) : Integer;
var
  aMsgDlg : TForm;
  CaptionIndex,
  i : integer;
  dlgButton : TButton; // uses stdctrls
begin
  // Dlg erzeugen
  aMsgDlg := CreateMessageDialog(Msg, DlgType, buttons);
  CaptionIndex := 0;
  // alle Objekte des Dialoges testen
  for i := 0 to aMsgDlg.ComponentCount - 1 do begin
    // wenn es ein Button ist, dann...
    if (aMsgDlg.Components[i] is TButton) then begin
      dlgButton := TButton(aMsgDlg.Components[i]);
      if CaptionIndex > High(Captions) then Break;
      // Beschriftung entsprechend Captions-array ändern
      dlgButton.Caption := Captions[CaptionIndex];
      Inc(CaptionIndex);
    end;
  end;
  Result := aMsgDlg.ShowModal;
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
var
  erg : integer;
begin
  erg := xMessageDlg('Hier steht der gewünschte Text,' + chr($0D) + 'die Buttons sind geändert',
                      mtConfirmation,
                      [mbYes, mbNo, mbCancel], // benutzte Schaltflächen
                      ['Alles', 'Teil','Abbrechen']); // zugehörige Texte
  case erg of // zugehörige Antworten
    mrYes : ShowMessage('"1" clicked');
    mrNo : ShowMessage('"2" clicked');
    mrCancel: ShowMessage('"3" clicked');
  end; // of case
end;

Source: http://www.delphipraxis.net/3307-caption-der-buttons-yes-no-im-dialog-messagedlg-aendern.html

Hidden
  • 3,598
  • 4
  • 34
  • 57