LazUtils, Translations unit: ensure uniqueness of flags in .po file items, ignore empty flags

git-svn-id: trunk@61267 -
This commit is contained in:
maxim 2019-05-21 23:50:58 +00:00
parent e3851a436a
commit 592a9daf42

View File

@ -1604,7 +1604,7 @@ begin
CurrentItem:=TPOFileItem.Create(lowercase(Identifier), Original, Translation);
CurrentItem.Comments := Comments;
CurrentItem.Context := Context;
CurrentItem.Flags := lowercase(Flags);
CurrentItem.ModifyFlag(lowercase(Flags), true);
CurrentItem.PreviousID := PreviousID;
CurrentItem.LineNr := LineNr;
FItems.Add(CurrentItem);
@ -1734,18 +1734,21 @@ var
var
i: Integer;
begin
i := F.IndexOf(AFlag);
if (i<0) and Check then
if AFlag <> '' then
begin
F.Add(AFlag);
Result := true;
end
else
begin
if (i>=0) and (not Check) then
i := F.IndexOf(AFlag);
if (i<0) and Check then
begin
F.Delete(i);
F.Add(AFlag);
Result := true;
end
else
begin
if (i>=0) and (not Check) then
begin
F.Delete(i);
Result := true;
end;
end;
end;
end;