mirror of
https://bitbucket.org/Dennis07/lina-components.git
synced 2025-02-22 10:32:12 +02:00
135 lines
3.4 KiB
ObjectPascal
135 lines
3.4 KiB
ObjectPascal
unit uLocalMgr;
|
|
|
|
//////////////////////////////////////
|
|
/// Lina Localize Manager Unit ///
|
|
/// **************************** ///
|
|
/// (c) 2014 Dennis Göhlert a.o. ///
|
|
//////////////////////////////////////
|
|
|
|
interface
|
|
|
|
uses
|
|
{ Standard-Units }
|
|
SysUtils, Classes, IniFiles,
|
|
{ Andere Package-Units }
|
|
uBase;
|
|
|
|
type
|
|
{ Hilfsklassen }
|
|
TComponentDetectMode = (cdTag,cdName);
|
|
TIdentifyStructure = (isSimple,isSection);
|
|
|
|
type
|
|
{ Hauptklassen }
|
|
TLocalization = class
|
|
private
|
|
{ Private-Deklarationen }
|
|
FFileName: TFileName;
|
|
FLanguageName: ShortString;
|
|
FLines: TStrings;
|
|
protected
|
|
{ Protected-Deklarationen }
|
|
public
|
|
{ Public-Deklarationen }
|
|
constructor Create; overload;
|
|
constructor Create(AFileName: TFileName); overload;
|
|
destructor Destroy;
|
|
function Check: Boolean;
|
|
published
|
|
{ Published-Deklarationen }
|
|
property FileName: TFileName read FFileName write FFileName;
|
|
property LanguageName: ShortString read FLanguageName write FLanguageName;
|
|
property Lines: TStrings read FLines;
|
|
end;
|
|
|
|
TLocalizations = array of TLocalization;
|
|
|
|
TLocalizationManager = class(TComponent)
|
|
private
|
|
{ Private-Deklarationen }
|
|
FAbout: TComponentAbout;
|
|
FLanguages: TLocalizations;
|
|
FCurrent: TLocalization;
|
|
FDefault: TLocalization;
|
|
FDetect: TComponentDetectMode;
|
|
FStructure: TIdentifyStructure;
|
|
protected
|
|
{ Protected-Deklarationen }
|
|
public
|
|
{ Public-Deklarationen }
|
|
constructor Create(AOwnder: TComponent); override;
|
|
destructor Destroy; override;
|
|
published
|
|
{ Published-Deklarationen }
|
|
property About: TComponentAbout read FAbout;
|
|
property Languages: TLocalizations read FLanguages write FLanguages;
|
|
property Current: TLocalization read FCurrent write FCurrent;
|
|
property Default: TLocalization read FDefault write FDefault;
|
|
property Detect: TComponentDetectMode read FDetect write FDetect default cdName;
|
|
property Structure: TIdentifyStructure read FStructure write FStructure default isSection;
|
|
end;
|
|
|
|
procedure Register;
|
|
|
|
const
|
|
{ Meta-Daten }
|
|
LocalizationManagerComponent_Name = 'LocalizationManager';
|
|
LocalizationManagerComponent_Version = 1.0;
|
|
LocalizationManagerComponent_Copyright = 'Copyright © 2014';
|
|
LocalizationManagerComponent_Author = 'Dennis Göhlert a.o.';
|
|
|
|
implementation
|
|
|
|
procedure Register;
|
|
begin
|
|
RegisterComponents(ComponentsPage,[TLocalizationManager]);
|
|
end;
|
|
|
|
{ ----------------------------------------------------------------------------
|
|
TLocalization
|
|
---------------------------------------------------------------------------- }
|
|
|
|
constructor TLocalization.Create;
|
|
begin
|
|
//...
|
|
end;
|
|
|
|
constructor TLocalization.Create(AFileName: TFileName);
|
|
begin
|
|
//...
|
|
end;
|
|
|
|
destructor TLocalization.Destroy;
|
|
begin
|
|
//...
|
|
end;
|
|
|
|
function TLocalization.Check: Boolean;
|
|
var
|
|
Index: Integer;
|
|
begin
|
|
|
|
for Index := 0 to Lines.Count do
|
|
begin
|
|
|
|
end;
|
|
end;
|
|
|
|
{ ----------------------------------------------------------------------------
|
|
TLocalizationManager
|
|
---------------------------------------------------------------------------- }
|
|
|
|
constructor TLocalizationManager.Create(AOwnder: TComponent);
|
|
begin
|
|
inherited;
|
|
FAbout := TComponentAbout.Create(LocalizationManagerComponent_Name,LocalizationManagerComponent_Version,LocalizationManagerComponent_Copyright,LocalizationManagerComponent_Author);
|
|
end;
|
|
|
|
destructor TLocalizationManager.Destroy;
|
|
begin
|
|
//...
|
|
inherited;
|
|
end;
|
|
|
|
end.
|