leonelquinteros / gotext

Go (Golang) GNU gettext utilities package
Other
434 stars 58 forks source link

Parse header in PO file is no longer compliant with GNU PO format #10

Closed JiangtianLi closed 7 years ago

JiangtianLi commented 7 years ago

It seems after this commit, the PO header requires a different format than https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html.

An empty untranslated-string is reserved to contain the header entry with the meta information (see Header Entry). This header entry should be the first entry of the file. The empty untranslated-string is reserved for this purpose and must not be used anywhere else.

A compliant header looks like:

msgid   ""
msgstr  "Project-Id-Version: %s\n"
        "Report-Msgid-Bugs-To: %s\n"
leonelquinteros commented 7 years ago

You're right, thanks for reporting!
I missed how that commit was commenting out these lines in the tests.

Fixing now.

JiangtianLi commented 7 years ago

Thanks for addressing it!

leonelquinteros commented 7 years ago

@JiangtianLi Please let me know if this was causing an issue on your side and if the last commit has fixed it.

Also, if you have any use case that you want to include on the tests, feel free to send a PR or simply the corresponding PO file fragment and some assertions so i can include these on the tests. It would be great to cover as much cases as possible.

Thanks again for your contribution. If everything goes well on your side, i'll make a new release version to include this fix so you can vendor it properly.

JiangtianLi commented 7 years ago

@leonelquinteros Thanks for the fix. Will try and update here.

JiangtianLi commented 7 years ago

It solved the issue in my case. Thanks for the prompt fix!