Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 09a808d

Browse filesBrowse files
committed
bug #30919 [Translator] Fix wrong dump for PO files (deguif)
This PR was merged into the 3.4 branch. Discussion ---------- [Translator] Fix wrong dump for PO files | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | When working on #30909 I encountered this bug. Currently the tests were passing, because the po fixture file contained only one translation. Commits ------- b54abfc Fix wrong dump for PO files
2 parents 86210b3 + b54abfc commit 09a808d
Copy full SHA for 09a808d

File tree

4 files changed

+7
-4
lines changed
Filter options

4 files changed

+7
-4
lines changed

‎src/Symfony/Component/Translation/Dumper/PoFileDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Dumper/PoFileDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
4040
$newLine = true;
4141
}
4242
$output .= sprintf('msgid "%s"'."\n", $this->escape($source));
43-
$output .= sprintf('msgstr "%s"', $this->escape($target));
43+
$output .= sprintf('msgstr "%s"'."\n", $this->escape($target));
4444
}
4545

4646
return $output;

‎src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class PoFileDumperTest extends TestCase
2020
public function testFormatCatalogue()
2121
{
2222
$catalogue = new MessageCatalogue('en');
23-
$catalogue->add(['foo' => 'bar']);
23+
$catalogue->add(['foo' => 'bar', 'bar' => 'foo']);
2424

2525
$dumper = new PoFileDumper();
2626

‎src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function testLoad()
2323
$resource = __DIR__.'/../fixtures/resources.po';
2424
$catalogue = $loader->load($resource, 'en', 'domain1');
2525

26-
$this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1'));
26+
$this->assertEquals(['foo' => 'bar', 'bar' => 'foo'], $catalogue->all('domain1'));
2727
$this->assertEquals('en', $catalogue->getLocale());
2828
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
2929
}

‎src/Symfony/Component/Translation/Tests/fixtures/resources.po

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Tests/fixtures/resources.po
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ msgstr ""
55
"Language: en\n"
66

77
msgid "foo"
8-
msgstr "bar"
8+
msgstr "bar"
9+
10+
msgid "bar"
11+
msgstr "foo"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.