bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug#516889: gettext: syntax error if comments are reordered (fwd)


From: Santiago Vila
Subject: Bug#516889: gettext: syntax error if comments are reordered (fwd)
Date: Thu, 25 Feb 2010 16:42:01 +0100 (CET)

Received this from the Debian BTS a lot of time ago.

There is a paragraph in the manual about this ("3 The Format of PO Files"),
but I'm not sure how conclusive it is in this case, so I'd like to
hear the author's opinion.

Thanks.

---------- Forwarded message ----------
From: Jens Seidel <address@hidden>
To: address@hidden
Date: Tue, 24 Feb 2009 11:03:01 +0100
Subject: Bug#516889: gettext: syntax error if comments are reordered

Package: gettext
Version: 0.17-4

Hi,

I noticed that msgmerge is very picky about the order of comments in PO
files.

$ cat test.po
msgid ""
msgstr ""
"Project-Id-Version: test\n"
"PO-Revision-Date: 2009-02-23 23:21+0100\n"
"Last-Translator: <address@hidden>\n"
"Language-Team: German <address@hidden>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#| msgid "File not found :-)"
#: test.cc:1
#, c-format
msgid "File not found"
msgstr "Datei nicht gefunden"


$ msgfmt -cv test.po 
test.po:13:1: syntax error
msgfmt: found 1 fatal error

Reordering the comments to
#: test.cc:1
#, c-format
#| msgid "File not found :-)"
fixes this problem.

You may ask why I used a PO file with such an ordering, right? The reason
is that I have also access to gettext version 0.15 (doesn't support
--previous option of msgmerge) and with this version I get:
$ sed 's/test.cc:1/test.cc:2/' test.po > test-new.po
$ msgmerge -U test-new.po test.po

Comments look now:
# | msgid "File not found :-)"
#: test.cc:1
#, c-format

I now substituted "# |" by "#|" because I don't want to commit a PO file
with unwanted "# |" comments and get an invalid file ...
Nevertheless gettext 0.15 doesn't report errors so I committed a bogus
file.

PS: Just in case you wonder why I call msgmerge to update a file against
itself: I found that this improves line breaks (the result of msgmerge
and xgettext is very different in this regard!!) and leads to smaller diffs
for version control systems. This is probably worth a separate bug report.

Jens




reply via email to

[Prev in Thread] Current Thread [Next in Thread]