Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6
System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64
User : User ( 0)
PHP Version : 7.4.6
Disable Function : NONE
Directory :  C:/xampp/src/xampp-control-panel/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : C:/xampp/src/xampp-control-panel/uLanguage.pas
unit uLanguage;

interface

uses
  GnuGettext, Windows, Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms,
  Dialogs, StdCtrls, Buttons, jpeg, ExtCtrls, Registry;

type
  TfLanguage = class(TForm)
    gbOptions: TGroupBox;
    ImgEn: TImage;
    ImgDe: TImage;
    rbEn: TRadioButton;
    rbDe: TRadioButton;
    bOkay: TBitBtn;
    bAbort: TBitBtn;
    procedure bOkClick(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure RadioGroup1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure bAbortClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    OldLang: string;
  public
  end;

var
  fLanguage: TfLanguage;

implementation

uses uTools, uMain;

{$R *.dfm}

procedure TfLanguage.bAbortClick(Sender: TObject);
begin
  ModalResult := mrAbort;
end;

procedure TfLanguage.bOkClick(Sender: TObject);
begin
  if rbEn.Checked then
    Config.Language := 'en'
  else if rbDe.Checked then
    Config.Language := 'de'
  else
    Config.Language := 'en';
  ModalResult := mrOk;

  if (OldLang <> '') and (OldLang <> Config.Language) then
    MessageDlg(_('Restart application to apply changes!'), mtInformation, [mbOk], 0);
end;

procedure TfLanguage.FormCreate(Sender: TObject);
begin
  TranslateComponent(self);
end;

procedure TfLanguage.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #27 then
  begin
    Key := #0;
    ModalResult := mrAbort;
    Close;
  end;
end;

procedure TfLanguage.FormShow(Sender: TObject);
begin
  OldLang := Config.Language;
  if Config.Language = 'en' then
    rbEn.Checked := true
  else if Config.Language = 'de' then
    rbDe.Checked := true
  else
    rbEn.Checked := true;
end;

procedure TfLanguage.RadioGroup1Click(Sender: TObject);
begin
  if (Sender = rbEn) or (Sender = ImgEn) then
    rbEn.Checked := true;
  if (Sender = rbDe) or (Sender = ImgDe) then
    rbDe.Checked := true;
end;

end.