From cf8b22b35e5e921c61a487de3e26dbbb2ccdea5c Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 16 Feb 2012 01:53:45 +0000 Subject: [PATCH] LCL: TPOFile: fixed continuation lines git-svn-id: trunk@35388 - --- components/pochecker/simplepofiles.pp | 69 +++++++++++++++------------ 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/components/pochecker/simplepofiles.pp b/components/pochecker/simplepofiles.pp index 313a1fb89c..5e52e141eb 100644 --- a/components/pochecker/simplepofiles.pp +++ b/components/pochecker/simplepofiles.pp @@ -34,7 +34,7 @@ { $define DebugSimplePoFiles} -{ $define ReadPoTextPChar} //define this to use the old ReadPoText method which uses PChars +{$define ReadPoTextPChar} //define this to use the old ReadPoText method which uses PChars unit SimplePoFiles; @@ -490,6 +490,12 @@ msgid "Do not show splash screen" msgstr "" } +type + TMsg = ( + mid, + mstr, + mctx + ); var l: Integer; LineLen: Integer; @@ -497,52 +503,54 @@ var LineStart: PChar; LineEnd: PChar; Identifier: String; - MsgID,MsgStr,PrevMsgID: String; - Line: String; + PrevMsgID: String; Comments: String; - Context: string; Flags: string; TextEnd: PChar; i: Integer; + //OldLineStartPos: PtrUInt; + //NewSrc: String; s: String; Handled: Boolean; + CurMsg: TMsg; + Msg: array[TMsg] of string; procedure ResetVars; begin - MsgId := ''; - MsgStr := ''; - Line := ''; + CurMsg:=mid; + Msg[mid]:=''; + Msg[mstr]:=''; + Msg[mctx]:=''; Identifier := ''; Comments := ''; - Context := ''; Flags := ''; PrevMsgID := ''; end; procedure AddEntry; - var - Item: TPOFileItem; + //var + // Item: TPOFileItem; begin if Identifier<>'' then begin // check for unresolved duplicates in po file - {Item := TPOFileItem(FOriginalToItem.Data[MsgID]); + {Item := TPOFileItem(FOriginalToItem.Data[Msg[mid]]); if (Item<>nil) then begin // fix old duplicate context if Item.Context='' then - Item.Context:=Item.Identifier; + Item.Context:=Item.IdentifierLow; // set context of new duplicate - if Context='' then - Context := Identifier; + if Msg[mctx]='' then + Msg[mctx] := Identifier; // if old duplicate was translated and // new one is not, provide a initial translation - if MsgStr='' then - MsgStr := Item.Translation; + if Msg[mstr]='' then + Msg[mstr] := Item.Translation; end;} - Add(Identifier,MsgID,MsgStr,Comments,Context,Flags,PrevMsgID,0); + Add(Identifier,Msg[mid],Msg[mstr],Comments,Msg[mctx],Flags,PrevMsgID,0); ResetVars; end else - if (Line<>'') and (FHeader=nil) then begin - FHeader := TPOFileItem.Create('',MsgID,Line); + if (Msg[CurMsg]<>'') and (FHeader=nil) then begin + FHeader := TPOFileItem.Create('',Msg[mid],Msg[CurMsg]); FHeader.Comments:=Comments; ResetVars; end @@ -558,10 +566,7 @@ begin LineStart:=p; TextEnd:=p+l; - Identifier:=''; - Comments:=''; - Line:=''; - Flags:=''; + ResetVars; while LineStart