[issue35335] msgfmt should be able to merge more than one po file

s-ball report at bugs.python.org
Sat Dec 1 13:33:52 EST 2018


s-ball <s-ball at laposte.net> added the comment:

I have followed SilentGhost's advice and begun by thoroughly testing the current behaviour. I then realized that I was wrong, and that (probably by chance) msgfmt.py partially followed my requirements, but pybabel did not and GNU gettext msgfmt did not really. I wrote 2 tiny po files (joined) and played with them, meaning I tried to combine them with pybabel, msgfmt.py and GNU gettext msg. Current behaviour (Windows shell syntax):

> pybabel compile -o .\file12-fr.mo -l fr -i file1-fr.po -i file2-fr.po

only uses second file (file2-fr.po)

> msgfmt -o file12-fr.mo --no-hash file1-fr.po file2-fr.po

chokes on a repeated key on file2 (the header has "" for key...). It works fine anyway after commenting out the header in any of the files

> python "path\to\Tools\i18n\msgfmt.py" -o file12py-fr.mo file1-fr.po file2-fr.po

unexpectedly produces the expected result and successfully combines both po files into one single mo file

BUT:

> python "path\to\Tools\i18n\msgfmt.py" file1-fr.po file2-fr.po

Produces file1-fr.mo which is the compiled version of file1-fr.po and file2-fr.mo which combines both input files. Definitely not an expected result!

This is caused by the problem identified in issue 9741 (https://bugs.python.org/issue9741)

My initial goal was to be able to use the make function from msgfmt.py in an external script. I then realize that combining multiple po files is not a good idea because the resulting mo file can only contain one single header and the best behaviour is GNU gettext msgfmt one.

I now wonder whether this issue should not be closed because the requirement is not relevant, and it would probably better to propose a fix (including tests and code improvement) for issue 9741.

----------
Added file: https://bugs.python.org/file47966/files.zip

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35335>
_______________________________________


More information about the Python-bugs-list mailing list