Skip to content

Commit

Permalink
Fix wrong dump for PO files
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed Apr 6, 2019
1 parent 86210b3 commit b54abfc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Translation/Dumper/PoFileDumper.php
Expand Up @@ -40,7 +40,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
$newLine = true;
}
$output .= sprintf('msgid "%s"'."\n", $this->escape($source));
$output .= sprintf('msgstr "%s"', $this->escape($target));
$output .= sprintf('msgstr "%s"'."\n", $this->escape($target));
}

return $output;
Expand Down
Expand Up @@ -20,7 +20,7 @@ class PoFileDumperTest extends TestCase
public function testFormatCatalogue()
{
$catalogue = new MessageCatalogue('en');
$catalogue->add(['foo' => 'bar']);
$catalogue->add(['foo' => 'bar', 'bar' => 'foo']);

$dumper = new PoFileDumper();

Expand Down
Expand Up @@ -23,7 +23,7 @@ public function testLoad()
$resource = __DIR__.'/../fixtures/resources.po';
$catalogue = $loader->load($resource, 'en', 'domain1');

$this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1'));
$this->assertEquals(['foo' => 'bar', 'bar' => 'foo'], $catalogue->all('domain1'));
$this->assertEquals('en', $catalogue->getLocale());
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
Expand Down
Expand Up @@ -5,4 +5,7 @@ msgstr ""
"Language: en\n"

msgid "foo"
msgstr "bar"
msgstr "bar"

msgid "bar"
msgstr "foo"

0 comments on commit b54abfc

Please sign in to comment.