8000 bug #9223 [Translator] PoFileDumper - PO headers (Padam87) · symfony/symfony@2ae07b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ae07b5

Browse files
committed
bug #9223 [Translator] PoFileDumper - PO headers (Padam87)
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #9223). Discussion ---------- [Translator] PoFileDumper - PO headers | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #6765 - partially | License | MIT | Doc PR | Po files should not be dumped without a header. It causes a lot of problems, including charset issues. See #6765 / 1 for more info Commits ------- e93bc50 [Translator] PoFileDumper - PO headers
2 parents 773932b + a8bc8ff commit 2ae07b5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ class PoFileDumper extends FileDumper
2525
*/
2626
public function format(MessageCatalogue $messages, $domain = 'messages')
2727
{
28-
$output = '';
28+
$output = 'msgid ""'."\n";
29+
$output .= 'msgstr ""'."\n";
30+
$output .= '"Content-Type: text/plain; charset=UTF-8\n"'."\n";
31+
$output .= '"Content-Transfer-Encoding: 8bit\n"'."\n";
32+
$output .= '"Language: '.$messages->getLocale().'\n"'."\n";
33+
$output .= "\n";
34+
2935
$newLine = false;
3036
foreach ($messages->all($domain) as $source => $target) {
3137
if ($newLine) {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
msgid ""
2+
msgstr ""
3+
"Content-Type: text/plain; charset=UTF-8\n"
4+
"Content-Transfer-Encoding: 8bit\n"
5+
"Language: en\n"
6+
17
msgid "foo"
28
msgstr "bar"

0 commit comments

Comments
 (0)
0