git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[GETTEXT BUG] xgettext(1) can't extract "gettext -- foo"

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 5, 2012, 09:05 UTC
Message-ID
<CACBZZX7rhA23k5Mz=dY6G_75hwBMgWbKrkAGJv4rd9URAh4vHw@mail.gmail.com>

The Git project is having issues with xgettext being unable to extract msgid's provided to gettext(1) where the first argument is --. Here's a minimal testcase:

    $ cat /tmp/xgettext-tesh.sh
    #!/bin/sh
    . gettext.sh
    gettext "hello "
    gettext -- "world"
    echo

If that's extracted with xgettext(1) the message on line 4 is presumed to be "--", when in fact it should be "world":

    $ xgettext --omit-header --force-po --output=/tmp/xgettext.po
--language=Shell --debug /tmp/xgettext-tesh.sh ; cat /tmp/xgettext.po
    #: /tmp/xgettext-tesh.sh:3
    msgid "hello "
    msgstr ""
    #: /tmp/xgettext-tesh.sh:4
    msgid "--"
    msgstr ""

There's currently a proposed patch to hack around this using something like:

    gitgettext () {
       gettext -- "$1"
       echo
    }

Is there a better way to handle this, and is this a bug the gettext project is aware of and might be fixing sometime soon?

Message 1 of 1 in “[GETTEXT BUG] xgettext(1) can't extract "gettext -- foo"”
  1. Ævar Arnfjörð BjarmasonJun 5, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.