From 592a9daf427c5ecf7df75346d421729722885d7a Mon Sep 17 00:00:00 2001 From: maxim Date: Tue, 21 May 2019 23:50:58 +0000 Subject: [PATCH] LazUtils, Translations unit: ensure uniqueness of flags in .po file items, ignore empty flags git-svn-id: trunk@61267 - --- components/lazutils/translations.pas | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/components/lazutils/translations.pas b/components/lazutils/translations.pas index c864f3800d..30fbd2dd29 100644 --- a/components/lazutils/translations.pas +++ b/components/lazutils/translations.pas @@ -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;