unit U_LNG;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, siComp;

type
  TF_LNG = class(TForm)
    siLangDisp: TsiLangDispatcher;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    FLangList: TStringList;
  public
    function GetActiveCharset: TFontCharSet;
  end;

var
  F_LNG: TF_LNG;

implementation

{$R *.dfm}

function TF_LNG.GetActiveCharset: TFontCharSet;
var
  LngIndex: Integer;
begin
  Result := DEFAULT_CHARSET;

  LngIndex := FLangList.IndexOf(siLangDisp.Language);
  if LngIndex <> -1 then
    Result := Integer(FLangList.Objects[LngIndex]);
  

  //if (siLangDisp.Language = 'RUS') or (siLangDisp.Language = 'RUS_ARH') then
  //  Result := RUSSIAN_CHARSET
  //else if siLangDisp.Language = 'UKR' then
  //  Result := RUSSIAN_CHARSET
  //else if siLangDisp.Language = 'ENG' then
  //  Result := DEFAULT_CHARSET
  //else if siLangDisp.Language = 'GER' then
  //  Result := ANSI_CHARSET
  //else if siLangDisp.Language = 'FRA' then
  //  Result := ANSI_CHARSET
  //else if siLangDisp.Language = 'SPA' then
  //  Result := ANSI_CHARSET;
end;

procedure TF_LNG.FormCreate(Sender: TObject);
begin
  FLangList := TStringList.Create;
  FLangList.Sorted := true;
  FLangList.AddObject('RUS', TObject(RUSSIAN_CHARSET));
  FLangList.AddObject('RUS_ARH', TObject(RUSSIAN_CHARSET));
  FLangList.AddObject('UKR', TObject(RUSSIAN_CHARSET));
  FLangList.AddObject('ENG', TObject(RUSSIAN_CHARSET));
  FLangList.AddObject('GER', TObject(ANSI_CHARSET));
  FLangList.AddObject('FRA', TObject(ANSI_CHARSET));
  FLangList.AddObject('SPA', TObject(ANSI_CHARSET));

  {
  FLangList.AddObject('RUS', TObject(RUSSIAN_CHARSET));
  FLangList.AddObject('RUS_ARH', TObject(RUSSIAN_CHARSET));
  FLangList.AddObject('UKR', TObject(RUSSIAN_CHARSET));
  FLangList.AddObject('ENG', TObject(DEFAULT_CHARSET));
  FLangList.AddObject('GER', TObject(ANSI_CHARSET));
  FLangList.AddObject('FRA', TObject(ANSI_CHARSET));
  FLangList.AddObject('SPA', TObject(ANSI_CHARSET));
  }
end;

procedure TF_LNG.FormDestroy(Sender: TObject);
begin
  FLangList.Free;
end;

end.
