mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 23:00:27 +02:00
LCL: improved translations handling, bug #26616:
- fixed typo which lead to PreviousMsg corruption/"accumulation" - improved line ending handling consistency (now treating #10#13 like single line ending, not like two ones) git-svn-id: trunk@46076 -
This commit is contained in:
parent
d062000bf3
commit
6cbf4971ee
@ -686,7 +686,7 @@ begin
|
|||||||
PrevMsgID:=PrevMsgID+GetUTF8String(LineStart+length('#| msgid "'),LineEnd-1);
|
PrevMsgID:=PrevMsgID+GetUTF8String(LineStart+length('#| msgid "'),LineEnd-1);
|
||||||
Handled:=true;
|
Handled:=true;
|
||||||
end else if IsKey(LineStart, '#| "') then begin
|
end else if IsKey(LineStart, '#| "') then begin
|
||||||
Msg[CurMsg] := Msg[CurMsg] + GetUTF8String(LineStart+length('#| "'),LineEnd-1);
|
PrevMsgID := PrevMsgID + GetUTF8String(LineStart+length('#| "'),LineEnd-1);
|
||||||
Handled:=true;
|
Handled:=true;
|
||||||
end;
|
end;
|
||||||
',':
|
',':
|
||||||
@ -977,6 +977,20 @@ begin
|
|||||||
// in lineending, fix here.
|
// in lineending, fix here.
|
||||||
if not (Value[Length(Value)] in [#13,#10]) then
|
if not (Value[Length(Value)] in [#13,#10]) then
|
||||||
Value := Value + LineEnding;
|
Value := Value + LineEnding;
|
||||||
|
|
||||||
|
//treat #10#13 sequences as #13#10 for consistency,
|
||||||
|
//e.g. #10#13#13#13#10#13#10 should become #13#10#13#13#10#13#10
|
||||||
|
p:=2;
|
||||||
|
while p<=Length(Value) do begin
|
||||||
|
if (Value[p]=#13) and (Value[p-1]=#10) then begin
|
||||||
|
Value[p]:=#10;
|
||||||
|
Value[p-1]:=#13;
|
||||||
|
end;
|
||||||
|
// further analysis shouldn't affect found #13#10 pair
|
||||||
|
if (Value[p]=#10) and (Value[p-1]=#13) then
|
||||||
|
inc(p);
|
||||||
|
inc(p);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
// po requires special characters as #number
|
// po requires special characters as #number
|
||||||
p:=1;
|
p:=1;
|
||||||
@ -1126,10 +1140,8 @@ begin
|
|||||||
P2 := pchar(S2);
|
P2 := pchar(S2);
|
||||||
Result := ord(P1^) - ord(P2^);
|
Result := ord(P1^) - ord(P2^);
|
||||||
|
|
||||||
while (Result=0) and (P1^<>#0) do begin
|
while (Result=0) and (L1>0) and (L2>0) and (P1^<>#0) do begin
|
||||||
Inc(P1); Inc(P2);
|
if (P1^<>P2^) or (P1^ in [#10,#13]) then begin
|
||||||
Dec(L1); Dec(L2);
|
|
||||||
if P1^<>P2^ then begin
|
|
||||||
C1 := SkipLineEndings(P1, L1);
|
C1 := SkipLineEndings(P1, L1);
|
||||||
C2 := SkipLineEndings(P2, L2);
|
C2 := SkipLineEndings(P2, L2);
|
||||||
if (C1<>C2) then
|
if (C1<>C2) then
|
||||||
@ -1140,6 +1152,8 @@ begin
|
|||||||
// there are no lineendings at all, will end loop
|
// there are no lineendings at all, will end loop
|
||||||
result := Ord(P1^)-Ord(P2^);
|
result := Ord(P1^)-Ord(P2^);
|
||||||
end;
|
end;
|
||||||
|
Inc(P1); Inc(P2);
|
||||||
|
Dec(L1); Dec(L2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// if strings are the same, check that all chars have been consumed
|
// if strings are the same, check that all chars have been consumed
|
||||||
|
Loading…
Reference in New Issue
Block a user