Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Translator] Fix wrong dump for PO files #30919

Merged
merged 1 commit into from Apr 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"