nitrojunkie / gettext-commons

Automatically exported from code.google.com/p/gettext-commons
GNU Lesser General Public License v2.1
0 stars 0 forks source link

msgfmt warning output breaks GettextDistTask #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. have a po file which contains a translation with non-matching \n at the
beginning of the string
i.e.:
msgid "\nWarning!\n"
msgstr "Achtung!"

2. using gnuwin32 gettext (0.14.4), gettext-ant-task version 0.9.7 (or earlier)
3. run the GettextDistTask Ant task 
The build will fail with the following message:
...build.xml:360: For input string: "C:\Dokumente"

This issue is caused by the GettextDiskTask's attempt to parse the output
of the command 'msgfmt --statistics path/to/the/pofile.po'
This usually looks like this:
"1244 translated messages, 43 fuzzy translations, 29 untranslated messages."

But in this case, the non-matching newlines generate an additional warning:
"...\lv.po:256: `msgid' and `msgstr' entries do not both begin with '\n'
16 translated messages, 4 fuzzy translations, 1296 untranslated messages."

What is the expected output? What do you see instead?

Ideally the parsing of the msgfmt output should be independent of such
warnings. It would be probably sufficient to parse the string starting at
the end, or taking into account the percentage number's labels.

Another way would be a less restrictive exception handling at this point to
continue the build for other languages.

I understand that the missing \n int the translation is actually a mistake
that should (and will) be fixed by the translators. But when maintaining a
large number of translations at different states of completion it is very
unfortunate that the whole build fails because of a warning produced for
one of the po files.

What version of the product are you using? On what operating system?
GnuWin32 gettext (0.14.4)
gettext-ant-task version 0.9.7

Original issue reported on code.google.com by tobiaskr...@gmail.com on 24 Mar 2010 at 2:16

GoogleCodeExporter commented 8 years ago
I adapted the parsing code in svn to only look at the last line of output from 
"msgfmt --
statistics". This fixes the described problem.

I tested that msgfmt in fact builds po files into message bundles with such 
warnings. So for 
the time being, it seems to make sense to not fail building the message bundles 
because of 
warnings.

Original comment by berge...@gmail.com on 23 Apr 2010 at 2:08