gitlocalize / feedback

:mega: We love feedback :sparkles:
20 stars 8 forks source link

GetText PO Multiline not handled correctly #128

Open Drkie opened 1 year ago

Drkie commented 1 year ago

Summary

When translating a multiline string in a POT/PO file, the msgstr generated isn't valid.

Steps to reproduce

Translate a multiline string in a PO file, then save. For example:

msgid ""
"Line 1\n"
"Line 2\n"
"Line 3"
msgstr ""

Repository URL

https://gitlocalize.com/repo/8365

What is the current bug behavior?

After saving, the generated msgstr looks like this:

msgstr "Line 1\n
Line 2\n
Line 3"

Notice the missing quotes on each line, as well as the deleted "" that should be on the first line.

What is the expected correct behavior?

The expected msgstr should look like this:

msgstr ""
"Line 1\n"
"Line 2\n"
"Line 3"

Relevant logs and/or screenshots

Please note that even if you don't make any changes in the file, GitLocalize will re-save over existing multiline strings and break them. Example diff: image On very large files, this makes it so having to go over every single multiline string and fix it manually can be extremely tedious.

Possible fixes

GitLocalize should ideally follow the correct formatting for PO files. The generated files become invalid/corrupted. A good way to validate this is opening the resulting files with Poedit, which shows the errors: image

ilyaspiridonov commented 1 year ago

Thanks for reporting this, we will review and raise this internally.