The gettext "msgfmt" command exits with status code 0 but does not write an .MO file

714 Views Asked by At

I've been making international-ready an application using the gettext family of tools, translating the .po. file to .mo using the msgfmt program. This was working at first, but as of the last few days it has stopped working. No errors are reported and the msgfmt program exists with a 0 status code.

I have manually checked out the .po file for problems with the formatting and have also run msgfmt --checkformat on the file, so there seems to be no problems with it. So I tried to create a simple file x.po to narrow down the problem. However, like the actual files in use, when running msgfmt -o x.mo x.po, the x.mo file is not written and msgfmt exits with a 0 status code as usual.

What is happening here?

Command: msgfmt -o x.mo x.po

x.po

#: blah.txt:1
msgid "blah"
msgstr ""

blah.txt

blah

EDIT: I'm sure this isn't a permissions error, because I've run the command as the root user.

2

There are 2 best solutions below

0
On

The .po file format requires a header.

0
On

Mo files contains only valid translations, fuzzy or empty translation will not be included. (I don't have enough points to add this as a comment)