Skip to content

Commit 8e391db

Browse files
committed
FIX - only every other nugget in messages.po is being translated #413
1 parent 96bf8b4 commit 8e391db

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: src/i18n.Domain/Concrete/POTranslationRepository.cs

+10-3
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ private Translation ParseTranslationFile(string langtag, List<string> fileNames,
480480

481481
if (line != null && (itemStarted || line.StartsWith("#~")))
482482
{
483-
TranslationItem item = ParseBody(fs, line, extractedComments);
483+
TranslationItem item = ParseBody(fs, ref line, extractedComments);
484484
if (item != null)
485485
{
486486
//
@@ -509,7 +509,14 @@ private Translation ParseTranslationFile(string langtag, List<string> fileNames,
509509
}
510510
}
511511

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; }
513520
}
514521
}
515522
}
@@ -546,7 +553,7 @@ private string RemoveCommentIfHistorical(string line)
546553
/// <param name="fs">A textreader that must be on the second line of a message body</param>
547554
/// <param name="line">The first line of the message body.</param>
548555
/// <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)
550557
{
551558
string originalLine = line;
552559

0 commit comments

Comments
 (0)