incorrectly parses MO files with no header
The MO file parser assumes that the first entry in the MO file is the header entry. This is true but only if the header entry actually exists. If it doesn't, then polib parses the MO file incorrectly.
As a test case I attached a MO file that contains two translated strings, but no header:
$ msgunfmt no-header.mo msgid "bar" msgstr "rab" msgid "foo" msgstr "oof"
This is how polib parses the file:
>>> import polib >>> print(polib.mofile('no-header.mo')) msgid "" msgstr "rab: \n" msgid "foo" msgstr "oof"