You've already forked lina-components
mirror of
https://bitbucket.org/Dennis07/lina-components.git
synced 2025-08-24 21:49:04 +02:00
Version 1.0 DEV 1.12b
Signed-off-by: Dennis07 <den.goehlert@t-online.de>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
; German language example
|
||||
HelloWorld = Hallo Welt!
|
||||
LanguageSelect = Sprache
|
||||
; No-section content
|
||||
HelloWorld = Hallo Welt! ; MessageBox variable
|
||||
Language = Sprache
|
||||
LanguageSelect @ LANGUAGE
|
||||
* Buttons
|
||||
Close = Schliessen
|
||||
Hello = Hallo!
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -413,7 +413,7 @@ type
|
||||
{ Published-Deklarationen }
|
||||
property DefaultValue: String read FDefaultValue write FDefaultValue;
|
||||
property Identifier: String read FIdentifier write SetIdentifier;
|
||||
property Format: TParamFormat read FFormat write SetFormat;
|
||||
property Format: TParamFormat read GetFormat write SetFormat;
|
||||
end;
|
||||
|
||||
TParamReferences = class(TCollection);
|
||||
@@ -1651,7 +1651,7 @@ end;
|
||||
|
||||
procedure TParamReference.SetFormat(Value: TParamFormat);
|
||||
begin
|
||||
FFormat := Value;
|
||||
FFormat.Assign(Value);
|
||||
end;
|
||||
|
||||
procedure TParamReference.SetIdentifier(Value: String);
|
||||
|
@@ -79,7 +79,11 @@ type
|
||||
procedure SetFormat(Value: TLocalizationFormat);
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
procedure RaiseParseError(Expected: String; Found: String; LineIndex: Integer;
|
||||
procedure RaiseParseError(Text: String; LineIndex: Integer;
|
||||
CharIndex: PChar; ExprLength: Integer = 0);
|
||||
procedure RaiseParseErrorUnexpected(Expected: String; Found: String; LineIndex: Integer;
|
||||
CharIndex: PChar; ExprLength: Integer = 0);
|
||||
procedure RaiseParseErrorUndeclared(Identifier: String; LineIndex: Integer;
|
||||
CharIndex: PChar; ExprLength: Integer = 0);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
@@ -92,7 +96,7 @@ type
|
||||
property Name: ShortString read FName write FName;
|
||||
property Tag: TLanguageTag read FTag write SetTag;
|
||||
property Lines: TStrings read GetLines write SetLines;
|
||||
property Format: TLocalizationFormat read GetFormat write FFormat;
|
||||
property Format: TLocalizationFormat read GetFormat write SetFormat;
|
||||
end;
|
||||
|
||||
TLocalizationManager = class;
|
||||
@@ -115,8 +119,6 @@ type
|
||||
Indents: array of TStringReferenceDataArray;
|
||||
Values: TStringArray;
|
||||
FManager: TLocalizationManager;
|
||||
{ Methoden }
|
||||
procedure WriteString(const Section,Indent: String; Value: String);
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
procedure AddSection(Section: String);
|
||||
@@ -135,6 +137,10 @@ type
|
||||
function ReadString(const Section,Indent: String; Default: String): String;
|
||||
function ReadInteger(const Section,Indent: String; Default: Integer): Integer;
|
||||
function ReadFloat(const Section,Indent: String; Default: Extended): Extended;
|
||||
procedure WriteString(const Section,Indent: String; Value: String);
|
||||
procedure WriteInteger(const Section,Indent: String; Value: Integer);
|
||||
procedure WriteFloat(const Section,Indent: String; Value: Extended);
|
||||
procedure Address(const Section,Indent,Target: String);
|
||||
end;
|
||||
|
||||
TLocalizationReferences = class(TCollection)
|
||||
@@ -179,8 +185,10 @@ type
|
||||
FData: TLocalizationData;
|
||||
FReferences: TLocalizationReferences;
|
||||
FCurrent: Integer;
|
||||
FIgnoreCase: Boolean;
|
||||
{ Methoden }
|
||||
procedure SetCurrent(Value: Integer);
|
||||
procedure SetIgnoreCase(Value: Boolean);
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
public
|
||||
@@ -194,6 +202,7 @@ type
|
||||
property Localizations: TLocalizations read FLocalizations write FLocalizations;
|
||||
property References: TLocalizationReferences read FReferences write FReferences;
|
||||
property Current: Integer read FCurrent write SetCurrent default -1;
|
||||
property IgnoreCase: Boolean read FIgnoreCase write SetIgnoreCase default True;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
@@ -238,13 +247,13 @@ var
|
||||
begin
|
||||
if (ArrayPos(Value,[FSeparator,FHeader,FIndent,FAddress]) <> -1) or (Length(Value) = 0) then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Comment"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Comment"');
|
||||
end;
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if Value[Index] in Spaces then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Comment"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Comment"');
|
||||
end;
|
||||
end;
|
||||
FComment := Value;
|
||||
@@ -256,13 +265,13 @@ var
|
||||
begin
|
||||
if (ArrayPos(Value,[FComment,FHeader,FIndent,FAddress]) <> -1) or (Length(Value) = 0) then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Separator"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Separator"');
|
||||
end;
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if Value[Index] in Spaces then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Separator"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Separator"');
|
||||
end;
|
||||
end;
|
||||
FSeparator := Value;
|
||||
@@ -274,13 +283,13 @@ var
|
||||
begin
|
||||
if ArrayPos(Value,[FComment,FSeparator,FIndent,FAddress]) <> -1 then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Header"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Header"');
|
||||
end;
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if Value[Index] in Spaces then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Header"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Header"');
|
||||
end;
|
||||
end;
|
||||
FHeader := Value;
|
||||
@@ -292,13 +301,13 @@ var
|
||||
begin
|
||||
if ArrayPos(Value,[FComment,FSeparator,FHeader,FAddress]) <> -1 then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Indent"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Indent"');
|
||||
end;
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if Value[Index] in Spaces then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Indent"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Indent"');
|
||||
end;
|
||||
end;
|
||||
FIndent := Value;
|
||||
@@ -308,15 +317,15 @@ procedure TLocalizationFormat.SetAddress(Value: ShortString);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if ArrayPos(Value,[FComment,FSeparator,FHeader,FIndent]) <> -1 then
|
||||
if (ArrayPos(Value,[FComment,FSeparator,FHeader,FIndent]) <> -1) or (Length(Value) = 0) then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Address"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Address"');
|
||||
end;
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if Value[Index] in Spaces then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Address"');
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Address"');
|
||||
end;
|
||||
end;
|
||||
FAddress := Value;
|
||||
@@ -382,13 +391,25 @@ end;
|
||||
|
||||
procedure TLocalization.SetFormat(Value: TLocalizationFormat);
|
||||
begin
|
||||
FFormat := Value;
|
||||
FFormat.Assign(FFormat);
|
||||
end;
|
||||
|
||||
procedure TLocalization.RaiseParseError(Expected: String; Found: String; LineIndex: Integer;
|
||||
procedure TLocalization.RaiseParseError(Text: String; LineIndex: Integer;
|
||||
CharIndex: PChar; ExprLength: Integer = 0);
|
||||
begin
|
||||
raise ELocalizationParse.Create('[' + IntToStr(LineIndex + 1) + '.' + IntToStr(Pos(String(CharIndex),Lines.Strings[LineIndex]) - ExprLength) + ']' + ' ' + Expected + ' expected, but ' + Found + ' found');
|
||||
raise ELocalizationParse.Create('[' + IntToStr(LineIndex + 1) + '.' + IntToStr(Pos(String(CharIndex),Lines.Strings[LineIndex]) - ExprLength) + ']' + ' ' + Text);
|
||||
end;
|
||||
|
||||
procedure TLocalization.RaiseParseErrorUnexpected(Expected: String; Found: String; LineIndex: Integer;
|
||||
CharIndex: PChar; ExprLength: Integer = 0);
|
||||
begin
|
||||
RaiseParseError(Expected + ' expected, but ' + Found + ' found',LineIndex,CharIndex,ExprLength);
|
||||
end;
|
||||
|
||||
procedure TLocalization.RaiseParseErrorUndeclared(Identifier: String; LineIndex: Integer;
|
||||
CharIndex: PChar; ExprLength: Integer = 0);
|
||||
begin
|
||||
RaiseParseError('Undeclared identifier: ' + '"' + Identifier + '"',LineIndex,CharIndex,ExprLength);
|
||||
end;
|
||||
|
||||
procedure TLocalization.Apply;
|
||||
@@ -419,7 +440,9 @@ var
|
||||
Position: (posPrefix,posIndent,posSeparator,posValue);
|
||||
Line: Integer;
|
||||
Complete: Boolean;
|
||||
Finished: Boolean;
|
||||
Header: Boolean;
|
||||
Address: Boolean;
|
||||
Current: PChar;
|
||||
InComment: PChar;
|
||||
Block: String;
|
||||
@@ -441,13 +464,15 @@ begin
|
||||
//Zeilenanfang
|
||||
Position := posPrefix;
|
||||
Header := False;
|
||||
Address := False;
|
||||
Complete := False;
|
||||
Finished := False;
|
||||
Current := @Lines.Strings[Line][1];
|
||||
InComment := @Format.Comment[1];
|
||||
//Parsen
|
||||
while Complete = False do
|
||||
begin
|
||||
if (not (Current^ in Spaces)) or (((Position = posValue) or (Header = True)) and (Length(Block) <> 0)) then
|
||||
if (not (Current^ in Spaces)) or ((((Address = False) and (Position = posValue)) or (Header = True)) and (Length(Block) <> 0)) then
|
||||
begin
|
||||
//Zeichen zu Block hinzuf�gen
|
||||
Block := Block + Current^;
|
||||
@@ -479,12 +504,14 @@ begin
|
||||
begin
|
||||
//Alternativ auch bei Zeilenende
|
||||
EoL:
|
||||
if (Length(Block) <> 0) or (Position = posValue) then
|
||||
if (Length(Block) <> 0) or ((Position = posValue) and (Address = False)) then
|
||||
begin
|
||||
if //Kommentaranfang
|
||||
((Block = Format.Comment) and ((Format.AllowComment = lpAnyPosition) or ((Format.AllowComment = lpBeginning) and (Current = @Lines.Strings[Line][1]))) or (Current = @Lines.Strings[Line][Length(Lines.Strings[Line])]) or (InComment^ = #0)) or
|
||||
(((Block = Format.Comment) and ((Format.AllowComment = lpAnyPosition) or ((Format.AllowComment = lpBeginning) and (Current = @Lines.Strings[Line][1]))) or (Current = @Lines.Strings[Line][Length(Lines.Strings[Line])]) or (InComment^ = #0)) or
|
||||
//Zeilenende
|
||||
((Current = @Lines.Strings[Line][Length(Lines.Strings[Line])]) and (not (Current^ in Spaces))) then
|
||||
((Current = @Lines.Strings[Line][Length(Lines.Strings[Line])]) and (not (Current^ in Spaces))) or
|
||||
//Addressenende
|
||||
(Address = True)) and (Finished = False) then
|
||||
begin
|
||||
//Block fertig
|
||||
if ((Position = posSeparator) and (Block = Format.Separator)) or ((Block = Format.Comment) and (Position = posPrefix)) or ((Header = True) and (Position = posIndent) and (Length(Block) <> 0)) or (Position = PosValue) then
|
||||
@@ -493,7 +520,6 @@ begin
|
||||
begin
|
||||
Block := '';
|
||||
end;
|
||||
Complete := True;
|
||||
if Header = True then
|
||||
begin
|
||||
//Ende von Header
|
||||
@@ -501,11 +527,31 @@ begin
|
||||
end else
|
||||
begin
|
||||
//Ende von Value
|
||||
(Collection as TLocalizations).FManager.Data.WriteString(Section,Indent,Block);
|
||||
if Address = False then
|
||||
begin
|
||||
//Wert
|
||||
(Collection as TLocalizations).FManager.Data.WriteString(Section,Indent,Block);
|
||||
end else
|
||||
begin
|
||||
//Adressierung
|
||||
Complete := (Current = @Lines.Strings[Line][Length(Lines.Strings[Line])]);
|
||||
if (Collection as TLocalizations).FManager.Data.IndentExists(Section,Block) = True then
|
||||
begin
|
||||
(Collection as TLocalizations).FManager.Data.Address(Section,Indent,Block);
|
||||
Finished := True;
|
||||
Block := '';
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end else
|
||||
begin
|
||||
RaiseParseErrorUndeclared(Block,Line,Current,Length(Block));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Complete := True;
|
||||
end else
|
||||
begin
|
||||
RaiseParseError('Prefix, indent or separator','end of line',Line,Current);
|
||||
RaiseParseErrorUnexpected('Argument','end of line',Line,Current);
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
@@ -520,7 +566,7 @@ begin
|
||||
Continue;
|
||||
end else
|
||||
begin
|
||||
RaiseParseError('Prefix','"' + Block + '"',Line,Current,Length(Block));
|
||||
RaiseParseErrorUnexpected('Prefix','"' + Block + '"',Line,Current,Length(Block));
|
||||
end;
|
||||
end;
|
||||
Header := (Block = Format.Header);
|
||||
@@ -531,12 +577,19 @@ begin
|
||||
Inc(Position);
|
||||
end;
|
||||
posSeparator: begin
|
||||
if Block <> Format.Separator then
|
||||
Address := (Block = Format.Address);
|
||||
if (Block <> Format.Separator) and (Address = False) then
|
||||
begin
|
||||
RaiseParseError('Separator','"' + Block + '"',Line,Current,Length(Block));
|
||||
RaiseParseErrorUnexpected('Separator or address mark','"' + Block + '"',Line,Current,Length(Block));
|
||||
end;
|
||||
Inc(Position);
|
||||
end;
|
||||
posValue: begin
|
||||
if Finished = True then
|
||||
begin
|
||||
RaiseParseErrorUnexpected('End of line','"' + Block + '"',Line,Current,Length(Block));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Block := '';
|
||||
@@ -605,37 +658,25 @@ begin
|
||||
end;
|
||||
|
||||
procedure TLocalizationData.AddIndent(const Section: String; Indent: String);
|
||||
{ Diese Methode soll NICHT direkt aufgerufen werden!
|
||||
Stattdessen die Methode WriteString() bzw. Address() verwenden, welche unter
|
||||
anderem auf diese Methode zur�ckgreift. Ansonsten kann es zu
|
||||
Zugriffsverletzungen oder nicht addressierten Werten kommen. }
|
||||
begin
|
||||
SetLength(Sections[ArrayPos(Section,Sections)].Reference^,Length(Sections[ArrayPos(Section,Sections)].Reference^) + 1);
|
||||
SetLength(Sections[IndexOfSection(Section)].Reference^,Length(Sections[IndexOfSection(Section)].Reference^) + 1);
|
||||
SetLength(Values,Length(Values) + 1);
|
||||
Sections[ArrayPos(Section,Sections)].Reference^[High(Sections[ArrayPos(Section,Sections)].Reference^)].Reference := @Values[High(Values)];
|
||||
Sections[ArrayPos(Section,Sections)].Reference^[High(Sections[ArrayPos(Section,Sections)].Reference^)].Value := Indent;
|
||||
end;
|
||||
|
||||
procedure TLocalizationData.WriteString(const Section,Indent: String; Value: String);
|
||||
begin
|
||||
if SectionExists(Section) = False then
|
||||
begin
|
||||
AddSection(Section);
|
||||
end;
|
||||
if IndentExists(Section,Indent) = False then
|
||||
begin
|
||||
AddIndent(Section,Indent);
|
||||
end;
|
||||
if ReadString(Section,Indent,'') <> Value then
|
||||
begin
|
||||
Sections[ArrayPos(Section,Sections)].Reference^[ArrayPos(Indent,Sections[ArrayPos(Section,Sections)].Reference^)].Reference^ := Value;
|
||||
end;
|
||||
Sections[IndexOfSection(Section)].Reference^[High(Sections[IndexOfSection(Section)].Reference^)].Reference := @Values[High(Values)];
|
||||
Sections[IndexOfSection(Section)].Reference^[High(Sections[IndexOfSection(Section)].Reference^)].Value := Indent;
|
||||
end;
|
||||
|
||||
function TLocalizationData.IndexOfSection(const Section: String): Integer;
|
||||
begin
|
||||
Result := ArrayPos(Section,Sections);
|
||||
Result := ArrayPos(Section,Sections,FManager.IgnoreCase);
|
||||
end;
|
||||
|
||||
function TLocalizationData.IndexOfIndent(const Section,Indent: String): Integer;
|
||||
begin
|
||||
Result := ArrayPos(Indent,Sections[ArrayPos(Section,Sections)].Reference^);
|
||||
Result := ArrayPos(Indent,Sections[IndexOfSection(Section)].Reference^,FManager.IgnoreCase);
|
||||
end;
|
||||
|
||||
function TLocalizationData.SectionExists(const Section: String): Boolean;
|
||||
@@ -645,7 +686,13 @@ end;
|
||||
|
||||
function TLocalizationData.IndentExists(const Section,Indent: String): Boolean;
|
||||
begin
|
||||
Result := (IndexOfIndent(Section,Indent) >= 0);
|
||||
if SectionExists(Section) = True then
|
||||
begin
|
||||
Result := (IndexOfIndent(Section,Indent) >= 0);
|
||||
end else
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalizationData.ReadSections(var ASections: TStrings);
|
||||
@@ -664,9 +711,9 @@ var
|
||||
Index: Integer;
|
||||
begin
|
||||
AIndents.Clear;
|
||||
for Index := Low(Sections[ArrayPos(Section,Sections)].Reference^) to High(Sections[ArrayPos(Section,Sections)].Reference^) do
|
||||
for Index := Low(Sections[IndexOfSection(Section)].Reference^) to High(Sections[IndexOfSection(Section)].Reference^) do
|
||||
begin
|
||||
AIndents.Add(Sections[ArrayPos(Section,Sections)].Reference^[Index].Value);
|
||||
AIndents.Add(Sections[IndexOfSection(Section)].Reference^[Index].Value);
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -675,9 +722,9 @@ var
|
||||
Index: Integer;
|
||||
begin
|
||||
AValues.Clear;
|
||||
for Index := Low(Sections[ArrayPos(Section,Sections)].Reference^) to High(Sections[ArrayPos(Section,Sections)].Reference^) do
|
||||
for Index := Low(Sections[IndexOfSection(Section)].Reference^) to High(Sections[IndexOfSection(Section)].Reference^) do
|
||||
begin
|
||||
AValues.Add(Sections[ArrayPos(Section,Sections)].Reference^[Index].Reference^);
|
||||
AValues.Add(Sections[IndexOfSection(Section)].Reference^[Index].Reference^);
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -685,7 +732,7 @@ function TLocalizationData.ReadString(const Section,Indent: String; Default: Str
|
||||
begin
|
||||
if (SectionExists(Section) = True) and (IndentExists(Section,Indent) = True) then
|
||||
begin
|
||||
Result := Sections[ArrayPos(Section,Sections)].Reference^[ArrayPos(Indent,Sections[ArrayPos(Section,Sections)].Reference^)].Reference^;
|
||||
Result := Sections[IndexOfSection(Section)].Reference^[IndexOfIndent(Section,Indent)].Reference^;
|
||||
end else
|
||||
begin
|
||||
Result := Default;
|
||||
@@ -702,6 +749,45 @@ begin
|
||||
Result := StrToFloat(ReadString(Section,Indent,FloatToStr(Default)));
|
||||
end;
|
||||
|
||||
procedure TLocalizationData.WriteString(const Section,Indent: String; Value: String);
|
||||
begin
|
||||
if SectionExists(Section) = False then
|
||||
begin
|
||||
AddSection(Section);
|
||||
end;
|
||||
if IndentExists(Section,Indent) = False then
|
||||
begin
|
||||
AddIndent(Section,Indent);
|
||||
end;
|
||||
if ReadString(Section,Indent,'') <> Value then
|
||||
begin
|
||||
Sections[IndexOfSection(Section)].Reference^[IndexOfIndent(Section,Indent)].Reference^ := Value;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalizationData.WriteInteger(const Section,Indent: String; Value: Integer);
|
||||
begin
|
||||
WriteString(Section,Indent,IntToStr(Value));
|
||||
end;
|
||||
|
||||
procedure TLocalizationData.WriteFloat(const Section,Indent: String; Value: Extended);
|
||||
begin
|
||||
WriteString(Section,Indent,FloatToStr(Value));
|
||||
end;
|
||||
|
||||
procedure TLocalizationData.Address(const Section,Indent,Target: String);
|
||||
begin
|
||||
if SectionExists(Section) = False then
|
||||
begin
|
||||
AddSection(Section);
|
||||
end;
|
||||
if IndentExists(Section,Indent) = False then
|
||||
begin
|
||||
AddIndent(Section,Indent);
|
||||
end;
|
||||
Sections[IndexOfSection(Section)].Reference^[IndexOfIndent(Section,Indent)].Reference := Sections[IndexOfSection(Section)].Reference^[IndexOfIndent(Section,Target)].Reference;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TLocalizationReferences
|
||||
---------------------------------------------------------------------------- }
|
||||
@@ -745,13 +831,13 @@ var
|
||||
begin
|
||||
if Length(Value) = 0 then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Indent"');
|
||||
raise EInvalidFormat.Create('Invalid reference format for property: "Indent"');
|
||||
end;
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if Value[Index] in Spaces then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid param format for property: "Indent"');
|
||||
raise EInvalidFormat.Create('Invalid reference format for property: "Indent"');
|
||||
end;
|
||||
end;
|
||||
FIndent := Value;
|
||||
@@ -862,6 +948,7 @@ begin
|
||||
FData := TLocalizationData.Create(Self);
|
||||
FReferences := TLocalizationReferences.Create(TLocalizationReference,Self);
|
||||
FCurrent := -1;
|
||||
FIgnoreCase := True;
|
||||
end;
|
||||
|
||||
destructor TLocalizationManager.Destroy;
|
||||
@@ -885,4 +972,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalizationManager.SetIgnoreCase(Value: Boolean);
|
||||
begin
|
||||
Current := Current;
|
||||
FIgnoreCase := Value;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@@ -213,11 +213,11 @@ type
|
||||
function ArrayPos(const AValue: Real; const AArray: array of Real): Integer; overload;
|
||||
function ArrayPos(const AValue: Extended; const AArray: array of Extended): Integer; overload;
|
||||
function ArrayPos(const AValue: Pointer; const AArray: array of TReferenceData): Integer; overload;
|
||||
function ArrayPos(const AValue: String; const AArray: array of TStringReferenceData): Integer; overload;
|
||||
function ArrayPos(const AValue: String; const AArray: array of TStringReferenceData; IgnoreCase: Boolean = False): Integer; overload;
|
||||
function ArrayPos(const AValue: Integer; const AArray: array of TIntegerReferenceData): Integer; overload;
|
||||
function ArrayPos(const AValue: Extended; const AArray: array of TFloatReferenceData): Integer; overload;
|
||||
function ArrayPos(const AValue: Pointer; const AArray: array of TRefDataArrayReferenceData): Integer; overload;
|
||||
function ArrayPos(const AValue: String; const AArray: array of TStringRefDataArrayReferenceData): Integer; overload;
|
||||
function ArrayPos(const AValue: String; const AArray: array of TStringRefDataArrayReferenceData; IgnoreCase: Boolean = False): Integer; overload;
|
||||
function ArrayPos(const AValue: Integer; const AArray: array of TIntegerRefDataArrayReferenceData): Integer; overload;
|
||||
function ArrayPos(const AValue: Extended; const AArray: array of TFloatRefDataArrayReferenceData): Integer; overload;
|
||||
{ TComponent Laden/Speichern }
|
||||
@@ -874,14 +874,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function ArrayPos(const AValue: String; const AArray: array of TStringReferenceData): Integer; overload;
|
||||
function ArrayPos(const AValue: String; const AArray: array of TStringReferenceData; IgnoreCase: Boolean = False): Integer; overload;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
Result := Low(AArray) - 1;
|
||||
for Index := Low(AArray) to High(AArray) do
|
||||
begin
|
||||
if AArray[Index].Value = AValue then
|
||||
if (AArray[Index].Value = AValue) or ((IgnoreCase = True) and (LowerCase(AArray[Index].Value) = LowerCase(AValue))) then
|
||||
begin
|
||||
Result := Index;
|
||||
Exit;
|
||||
@@ -934,14 +934,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function ArrayPos(const AValue: String; const AArray: array of TStringRefDataArrayReferenceData): Integer; overload;
|
||||
function ArrayPos(const AValue: String; const AArray: array of TStringRefDataArrayReferenceData; IgnoreCase: Boolean = False): Integer; overload;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
Result := Low(AArray) - 1;
|
||||
for Index := Low(AArray) to High(AArray) do
|
||||
begin
|
||||
if AArray[Index].Value = AValue then
|
||||
if (AArray[Index].Value = AValue) or ((IgnoreCase = True) and (LowerCase(AArray[Index].Value) = LowerCase(AValue))) then
|
||||
begin
|
||||
Result := Index;
|
||||
Exit;
|
||||
|
Reference in New Issue
Block a user