Running:
> xgettext test.py -o out.pot
On the Python snippet test.py:
def main(num):
gettext("TEST")
ngettext(num, "TEST", "TESTS")
Produces a pot file with the following row (translated strings are in the po file):
#: test.py:3 test.py:4
msgid "TEST"
msgid_plural "TESTS"
msgstr[0] "TEST-SINGLE"
msgstr[1] "TEST-PLURAL"
After turning this into a po file and then a mo file. I cannot get translations for gettest("TEST") calls.
> ngettext("TEST", "TESTS", 1)
> TEST-SINGLE
> gettext("TEST")
> TEST
I am using the standard gettext package for Python. I am not sure if these merging behaviour is expected, but it seems to destroy the ability to look up translations for for non pluralized strings. Is there a way to avoid this?
I was thinking of hacking up a fallback for gettext, to try a ngettext call if the first one fails. That seems very hacky though.