{********************************************************************}
{                                                                    }
{ written by TMS Software                                            }
{            Copyright (c) 2019                                      }
{            Email : info@tmssoftware.com                            }
{            Web : http://www.tmssoftware.com                        }
{                                                                    }
{ The source code is given as is. The author is not responsible      }
{ for any possible damage done due to the use of this code.          }
{ The complete source code remains property of the author and may    }
{ not be distributed, published, given or sold in any form as such.  }
{ No parts of the source code can be included in any other component }
{ or application without written authorization of the author.        }
{********************************************************************}

unit XData.Resource;

interface

type
  TTMSXDataIDELanguage = (tilEnglish, tilGerman, tilFrench);

  TMSWebXDataIDEResources = record
  strict private
    class function GetIDELanguage: TTMSXDataIDELanguage; static;
  public
    class function SNewXDataConsoleServer: string; static;
    class function SNewXDataVclServer: string; static;
    class function SXDataConsoleServer: string; static;
    class function SXDataVclServer: string; static;
  end;

implementation

uses
  System.SysUtils, System.StrUtils, ToolsAPI;

resourcestring
  //English
  SNewXDataConsoleServerEN = 'Creates a TMS XData Console Server';
  SNewXDataVclServerEN = 'Creates a TMS XData VCL Server';
  SXDataConsoleServerEN = 'TMS XData Console Server';
  SXDataVclServerEN = 'TMS XData VCL Server';

  //German
  SNewXDataConsoleServerDE = 'Erzeugt einen XData Konsolen Server';
  SNewXDataVclServerDE = 'Erzeugt einen TMS XData VCL Server';
  SXDataConsoleServerDE = 'TMS XData Konsole Server';
  SXDataVclServerDE = 'TMS XData VCL Server';

  //French
  SNewXDataConsoleServerFR = 'Génére un XData Console Serveur';
  SNewXDataVclServerFR = 'Génére un XData VCL Serveur';
  SXDataConsoleServerFR = 'XData Console Serveur';
  SXDataVclServerFR = 'XData VCL Serveur';

{ TMSWebXDataIDEResources }

class function TMSWebXDataIDEResources.GetIDELanguage: TTMSXDataIDELanguage;
const
  cGermanLang = 'DE';
  cFrenshLang = 'FR';
var
  lService: IOTAServices;
begin
  Result := tilEnglish;
  if Supports(BorlandIDEServices, IOTAServices, lService) then
  begin
    if StartsText(cGermanLang, lService.GetIDEPreferredUILanguages) then
      Result := tilGerman
    else if StartsText(cFrenshLang, lService.GetIDEPreferredUILanguages) then
      Result := tilFrench;
  end;
end;

class function TMSWebXDataIDEResources.SNewXDataConsoleServer: string;
begin
  case GetIDELanguage of
    tilGerman: Result := SNewXDataConsoleServerDE;
    tilFrench: Result := SNewXDataConsoleServerFR;
  else
    Result := SNewXDataConsoleServerEN;
  end;
end;

class function TMSWebXDataIDEResources.SNewXDataVclServer: string;
begin
  case GetIDELanguage of
    tilGerman: Result := SNewXDataVclServerDE;
    tilFrench: Result := SNewXDataVclServerFR;
  else
    Result := SNewXDataVclServerEN;
  end;
end;

class function TMSWebXDataIDEResources.SXDataConsoleServer: string;
begin
  case GetIDELanguage of
    tilGerman: Result := SXDataConsoleServerDE;
    tilFrench: Result := SXDataConsoleServerFR;
  else
    Result := SXDataConsoleServerEN;
  end;
end;

class function TMSWebXDataIDEResources.SXDataVclServer: string;
begin
  case GetIDELanguage of
    tilGerman: Result := SXDataVclServerDE;
    tilFrench: Result := SXDataVclServerFR;
  else
    Result := SXDataVclServerEN;
  end;
end;

end.
