Localization of MessageDlg in Delphi

Built-in MessageDlg function shows texts such as Yes, No, Confirmation only in English.

function MyMessageDlg(CONST Msg: string; DlgTypt: TmsgDlgType; button: TMsgDlgButtons;
 Caption: ARRAY OF string; dlgcaption: string): Integer;
var
 aMsgdlg: TForm;
 i: Integer;
 Dlgbutton: Tbutton;
 Captionindex: Integer;
begin
 aMsgdlg := createMessageDialog(Msg, DlgTypt, button);
 aMsgdlg.Caption := dlgcaption;
//aMsgdlg.BiDiMode := bdRightToLeft;
 Captionindex := 0;
 for i := 0 to aMsgdlg.componentcount - 1 Do
 begin
 if (aMsgdlg.components[i] is Tbutton) then
 Begin
 Dlgbutton := Tbutton(aMsgdlg.components[i]);
 if Captionindex <= High(Caption) then
 Dlgbutton.Caption := Caption[Captionindex];
 inc(Captionindex);
 end;
 end;
 Result := aMsgdlg.Showmodal;
end;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s