Page 1 of 1

IWCGMessageDlg Translation

PostPosted: 09 Dec 2015 18:35
by assapan
Hi,
As variables IWCGMsgDlgTitles and IWCGMsgButtonCaptions in IWCGJQMessageDlg are global i face the problem of different sessions with different languages at the same time.

I had no time to deeply thing on how it would be the best so i modify the source to meet my own requirement which can be different to other users.

So i quickly modified the source to add

in types
Code: Select all
  TIWCGMsgDialogGetButtonText = TFunc<TMsgDlgBtn, string>;
  TIWCGMsgDialogGetTitle = TFunc<TMsgDlgType, string>;


In interface
Code: Select all
var
  OnMsgDlgGetButtonText: TIWCGMsgDialogGetButtonText;
  OnMsgDlgGetTitle: TIWCGMsgDialogGetTitle;


In TIWCGJQMsgDialog.SetTitle
Code: Select all
    if Assigned(OnMsgDlgGetTitle) then
      JQDialogOptions.Title := OnMsgDlgGetTitle(DlgType)
    else
      JQDialogOptions.Title := IWCGMsgDlgTitles[DlgType];


in TIWCGJQMsgDialog.CreateButtons;
Code: Select all
      if Assigned(OnMsgDlgGetButtonText) then
        Button.Text := OnMsgDlgGetButtonText(DlgBtn)
      else
        Button.Text := IWCGMsgButtonCaptions[DlgBtn];


Could you please think about a more general modification :)