php-gettext / Gettext

PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
MIT License
687 stars 134 forks source link

Multi line strings: Wrong behaviour with \n #244

Closed vielhuber closed 4 years ago

vielhuber commented 4 years ago

Hello!

When I create a new translation with.

        $translation = Translation::create(null, "foo\nbar");
        $translation->translate("bar\nbaz");
        $this->translations->add($translation);

I end up with a PO file that looks like this:

msgid ""
"foo"
"bar\n"
msgstr ""
"bar"
"baz\n"

The expected behaviour should be:

msgid ""
"foo\n"
"bar"
msgstr ""
"bar\n"
"baz"
oscarotero commented 4 years ago

Hi, @vielhuber Yes, you're absolutelly right, this a bug. Sorry about that. I've released a patch version with a fix. Thanks

vielhuber commented 4 years ago

Very good, it works. Thank you for this awesome lib.