Weblate: Generate MO files addon generates incorrect MO file from monolingual PO file

Created on 23 Apr 2019  路  4Comments  路  Source: WeblateOrg/weblate

Describe the bug
When using the Generate MO files addon, the resulting MO files when creating from monolingual PO files are incorrect. For the msgid, only the first character from the ID is taken and used. Also, every entry has a msgid_plural property, even though the original file does not have them. Moreover, the msgstr is array based, with only one entry (not sure if this last one is a problem).

I've included a snippet of the original .po file and the resulting .mo at the bottom of this issue.

This issue is very much related to this issue. We had that problem as well, and were eager to use the fix for the 3.6 version, but now we're encountering this problem. Though, the resulting problems in the MO files are different, hence creating a new issue instead of commenting on the linked one.

To Reproduce
Steps to reproduce the behavior (copied from the linked issue, because the steps are the same):

  1. Add a component which uses monolingual PO files
  2. Add the MO addon
  3. Translate some files
  4. Commit the changes
  5. Check the generated MO file with a gettext tool, for example msgunfmt on the command line.

Expected behavior
The resulting MO structure from the msgunfmt command should be identical (or functionally identical) to the original PO file.

Example file

Snippet from the PO file:

msgid "action.cancel.text"
msgstr "cancel"

msgid "action.confirm.text"
msgstr "confirm"

Snippet from the msgunfmt result of the MO file (with the same fields):

msgid "a"
msgid_plural "c"
msgstr[0] "cancel"

msgid "a"
msgid_plural "c"
msgstr[0] "confirm"
bug

Most helpful comment

Yes, there will be 3.6.1 in few days.

All 4 comments

We just updated to 3.6 to check if the MO plugin was working again for us. Before it didn't, like I mentioned in my previously reported issue. Now it still doesn't because of this issue.

Thank you for your report, the issue you have reported has just been fixed.

  • In case you see problem with the fix, please comment on this issue.
  • In case you see similar problem, please open separate issue.
  • If you are happy with the outcome, consider supporting Weblate by donating.

@nijel I see you fixed it already, but the fix will be part of the 3.7 update which is due to June 15. Can you maybe release a bugfix update with this fix included (3.6.1)?

Yes, there will be 3.6.1 in few days.

Was this page helpful?
0 / 5 - 0 ratings