Skip to content

Commit 4a4181c

Browse files
committed
Treat empty comments as empty lines
1 parent f343e17 commit 4a4181c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Extractors/Po.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public static function fromString($string, Translations $translations, array $op
2929
$line = trim($lines[$i]);
3030
$line = static::fixMultiLines($line, $lines, $i);
3131

32+
if ($line === "#") {
33+
$line = "";
34+
}
35+
3236
if ($line === '') {
3337
if ($translation->is('', '')) {
3438
static::extractHeaders($translation->getTranslation(), $translations);
@@ -52,17 +56,9 @@ public static function fromString($string, Translations $translations, array $op
5256
$data = isset($splitLine[1]) ? $splitLine[1] : '';
5357
}
5458

55-
// If a translation is followed by a comment instead of a newline, create a new translation.
56-
if ((0 === strpos($line, '#')) && $translation->hasOriginal() && ! $translation->isDisabled()) {
57-
$translations[] = $translation;
58-
$translation = $translations->createNewTranslation('', '');
59-
}
60-
6159
switch ($key) {
6260
case '#':
63-
if ('' !== $data) {
64-
$translation->addComment($data);
65-
}
61+
$translation->addComment($data);
6662
$append = null;
6763
break;
6864

0 commit comments

Comments
 (0)