diff --git a/src/Extractors/Po.php b/src/Extractors/Po.php index 4343a792..5c9cee64 100644 --- a/src/Extractors/Po.php +++ b/src/Extractors/Po.php @@ -29,6 +29,10 @@ public static function fromString($string, Translations $translations, array $op $line = trim($lines[$i]); $line = static::fixMultiLines($line, $lines, $i); + if ($line === "#") { + $line = ""; + } + if ($line === '') { if ($translation->is('', '')) { static::extractHeaders($translation->getTranslation(), $translations); diff --git a/tests/AssetsTest.php b/tests/AssetsTest.php index 5a270f68..eed5d07f 100644 --- a/tests/AssetsTest.php +++ b/tests/AssetsTest.php @@ -89,13 +89,13 @@ public function testPo2() public function testPo3() { $translations = static::get('po3/input', 'Po'); - $countTranslations = 8; - $countTranslated = 8; + $countTranslations = 10; + $countTranslated = 10; $countHeaders = 8; $this->assertCount($countTranslations, $translations); $this->assertCount($countHeaders, $translations->getHeaders()); - $this->assertEquals(8, $translations->countTranslated()); + $this->assertEquals(10, $translations->countTranslated()); $this->assertContent($translations, 'po3/Po'); $this->assertContent($translations, 'po3/Mo'); diff --git a/tests/assets/po3/Csv.csv b/tests/assets/po3/Csv.csv index 6607e447..fb292241 100644 --- a/tests/assets/po3/Csv.csv +++ b/tests/assets/po3/Csv.csv @@ -15,3 +15,5 @@ Report-Msgid-Bugs-To: ,"1 child","1 fillo" ,"1 comment","1 comentario" ,"1 star","1 estrela" +,"1 world","1 Welt" +,"1 sun","1 Sonne" diff --git a/tests/assets/po3/CsvDictionary.csv b/tests/assets/po3/CsvDictionary.csv index 09b53c1b..61b5bcd3 100644 --- a/tests/assets/po3/CsvDictionary.csv +++ b/tests/assets/po3/CsvDictionary.csv @@ -6,3 +6,5 @@ Kunststoffboden,"synthetic floor" "1 child","1 fillo" "1 comment","1 comentario" "1 star","1 estrela" +"1 world","1 Welt" +"1 sun","1 Sonne" diff --git a/tests/assets/po3/Jed.json b/tests/assets/po3/Jed.json index e1f724ca..b4a2c885 100644 --- a/tests/assets/po3/Jed.json +++ b/tests/assets/po3/Jed.json @@ -28,6 +28,12 @@ ], "1 star": [ "1 estrela" + ], + "1 world": [ + "1 Welt" + ], + "1 sun": [ + "1 Sonne" ] } } \ No newline at end of file diff --git a/tests/assets/po3/Json.json b/tests/assets/po3/Json.json index 3af07b87..92cc47d0 100644 --- a/tests/assets/po3/Json.json +++ b/tests/assets/po3/Json.json @@ -29,6 +29,12 @@ ], "1 star": [ "1 estrela" + ], + "1 world": [ + "1 Welt" + ], + "1 sun": [ + "1 Sonne" ] } } diff --git a/tests/assets/po3/JsonDictionary.json b/tests/assets/po3/JsonDictionary.json index 0bdf9562..581a48a6 100644 --- a/tests/assets/po3/JsonDictionary.json +++ b/tests/assets/po3/JsonDictionary.json @@ -6,5 +6,7 @@ "Kunststoffboden": "synthetic floor", "1 child": "1 fillo", "1 comment": "1 comentario", - "1 star": "1 estrela" + "1 star": "1 estrela", + "1 world": "1 Welt", + "1 sun": "1 Sonne" } \ No newline at end of file diff --git a/tests/assets/po3/Mo.mo b/tests/assets/po3/Mo.mo index d13d6348..95a5059a 100644 Binary files a/tests/assets/po3/Mo.mo and b/tests/assets/po3/Mo.mo differ diff --git a/tests/assets/po3/PhpArray.php b/tests/assets/po3/PhpArray.php index 33289afc..f9ad5da5 100644 --- a/tests/assets/po3/PhpArray.php +++ b/tests/assets/po3/PhpArray.php @@ -49,6 +49,14 @@ array ( 0 => '1 estrela', ), + '1 world' => + array ( + 0 => '1 Welt', + ), + '1 sun' => + array ( + 0 => '1 Sonne', + ), ), ), ); \ No newline at end of file diff --git a/tests/assets/po3/Po.po b/tests/assets/po3/Po.po index 7aed93ec..25faa1d2 100644 --- a/tests/assets/po3/Po.po +++ b/tests/assets/po3/Po.po @@ -39,3 +39,9 @@ msgid "1 star" msgid_plural "%s stars" msgstr[0] "1 estrela" msgstr[1] "" + +msgid "1 world" +msgstr "1 Welt" + +msgid "1 sun" +msgstr "1 Sonne" diff --git a/tests/assets/po3/Xliff.xlf b/tests/assets/po3/Xliff.xlf index 0703aae8..39367352 100644 --- a/tests/assets/po3/Xliff.xlf +++ b/tests/assets/po3/Xliff.xlf @@ -86,5 +86,23 @@ 1 estrela + + + + + + 1 world + 1 Welt + + + + + + + + 1 sun + 1 Sonne + + diff --git a/tests/assets/po3/Yaml.yml b/tests/assets/po3/Yaml.yml index f65e3da6..14632580 100644 --- a/tests/assets/po3/Yaml.yml +++ b/tests/assets/po3/Yaml.yml @@ -12,3 +12,5 @@ messages: '1 child': '1 fillo' '1 comment': '1 comentario' '1 star': '1 estrela' + '1 world': '1 Welt' + '1 sun': '1 Sonne' diff --git a/tests/assets/po3/YamlDictionary.yml b/tests/assets/po3/YamlDictionary.yml index e2a553e1..a6d6eabd 100644 --- a/tests/assets/po3/YamlDictionary.yml +++ b/tests/assets/po3/YamlDictionary.yml @@ -6,3 +6,5 @@ Kunststoffboden: 'synthetic floor' '1 child': '1 fillo' '1 comment': '1 comentario' '1 star': '1 estrela' +'1 world': '1 Welt' +'1 sun': '1 Sonne' diff --git a/tests/assets/po3/input.po b/tests/assets/po3/input.po index f97e3e2d..0ae23e51 100644 --- a/tests/assets/po3/input.po +++ b/tests/assets/po3/input.po @@ -37,3 +37,9 @@ msgstr[1] "" msgid "1 star" msgstr "1 estrela" +# +msgid "1 world" +msgstr "1 Welt" +# +msgid "1 sun" +msgstr "1 Sonne"