bugGNU gettext - Bugs: bug #22487, xgettext extracts ""...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #22487: xgettext extracts "" entry with --omit-header [patch]

Submitted by:  Vaclav Slavik <vslavik>
Submitted on:  Wed 05 Mar 2008 09:39:00 AM UTC  
 
Category: Programmer toolsSeverity: 3 - Normal
Item Group: NoneStatus: Not a Bug
Privacy: PublicAssigned to: Bruno Haible <haible>
Open/Closed: Closed

Thu 06 Mar 2008 09:24:04 AM UTC, comment #2:

> gettext() at runtime. There is no point then for you to use
> --omit-header.


Actually, there is. It's the only workaround for bug #20923 known to me -- and until yesterday, I didn't realize you're even considering fixing the incorrect-on-purpose CHARSET entry in POT files.

Vaclav Slavik <vslavik>
Thu 06 Mar 2008 01:23:39 AM UTC, comment #1:

An important use-case for --omit-header is when the resulting
message catalog is not to be used with the GNU gettext() function.
It may be an X/Open message catalog, a Java .properties file,
a Pascal message catalog, or other variants.

In these cases --omit-header is passed because there is no use
for a header in the format of GNU PO files, and because the empty
string may be valid input.

Therefore the warning is omitted in this case. (There is nothing
to warn about if the message catalog being produced is not meant
to be used with the GNU gettext() function!) And gettext("") also
leads to msgid "", since that's what the user wants when passing
--omit-header.

You appear to want the normal behaviour of xgettext, and to use
gettext() at runtime. There is no point then for you to use
--omit-header.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Wed 05 Mar 2008 09:39:00 AM UTC, original submission:

When I run xgettext to extract strings from a file that contains gettext(""), it issues a warning about it. But when I use --omit-header, it doesn't show the warning (even though it's equally true) and it outputs msgid "" entry:

$ cat >test.c
const char* header()
{
return gettext("");
return gettext("foo");
}
$ xgettext -o- --omit-header test.c
#: test.c:3
msgid ""
msgstr ""

#: test.c:4
msgid "foo"
msgstr ""
$

This invalid header (that I explicitly asked to be omitted) then confuses other tools, e.g. msgcat:

$ xgettext -o- --omit-header test.c | msgcat -
<stdin>: warning: Charset missing in header.
Message conversion to user's charset will not work.
...

From looking at the CVS repository, the code that is causing this was there from the beginning, so chances are it isn't intentional. I suggest that xgettext a) issues the warning regardless of --omit-header and b) doesn't output msgid "" entry. Am I missing something?

Attached patch against CVS does a)+b) above.

Vaclav Slavik <vslavik>

 

Attached Files
file #15183:  gettext-always-omit-empty-entry.patch added by vslavik (980B - application/octet-stream - proposed patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by haible (Posted a comment)
  • -unavailable- added by vslavik (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 26 Nov 2016 11:54:18 PM UTChaibleCategoryNone=>Programmer tools
    Thu 06 Mar 2008 01:54:53 AM UTChaibleStatusWont Fix=>Not a Bug
    Thu 06 Mar 2008 01:23:39 AM UTChaibleStatusNone=>Wont Fix
      Assigned toNone=>haible
      Open/ClosedOpen=>Closed
    Wed 05 Mar 2008 09:39:01 AM UTCvslavikAttached File-=>Added gettext-always-omit-empty-entry.patch, #15183

    Back to the top


    Powered by Savane 3.1-cleanup1