@@ -480,7 +480,7 @@ private Translation ParseTranslationFile(string langtag, List<string> fileNames,
480
480
481
481
if ( line != null && ( itemStarted || line . StartsWith ( "#~" ) ) )
482
482
{
483
- TranslationItem item = ParseBody ( fs , line , extractedComments ) ;
483
+ TranslationItem item = ParseBody ( fs , ref line , extractedComments ) ;
484
484
if ( item != null )
485
485
{
486
486
//
@@ -509,7 +509,14 @@ private Translation ParseTranslationFile(string langtag, List<string> fileNames,
509
509
}
510
510
}
511
511
512
- itemStarted = false ;
512
+ // If line is not empty here, we are skipping over some unrecognized text.
513
+ // On the other hand, if the line is empty, it means we are at a delimiter
514
+ // between message items so consider item as started.
515
+ // Note that the ParseBody method call above now takes a ref to the 'line' variable
516
+ // and on completion of successful read of a message item section it leaves line set
517
+ // to empty string, marking the start of a new item. #351, #413
518
+ if ( ! string . IsNullOrWhiteSpace ( line ) ) {
519
+ itemStarted = false ; }
513
520
}
514
521
}
515
522
}
@@ -546,7 +553,7 @@ private string RemoveCommentIfHistorical(string line)
546
553
/// <param name="fs">A textreader that must be on the second line of a message body</param>
547
554
/// <param name="line">The first line of the message body.</param>
548
555
/// <returns>Returns a TranslationItem with only key, id and message set</returns>
549
- private TranslationItem ParseBody ( TextReader fs , string line , IEnumerable < string > extractedComments )
556
+ private TranslationItem ParseBody ( TextReader fs , ref string line , IEnumerable < string > extractedComments )
550
557
{
551
558
string originalLine = line ;
552
559
0 commit comments