bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] argp and gettext


From: Bruno Haible
Subject: [Bug-gnulib] argp and gettext
Date: Mon, 13 Sep 2004 12:51:01 +0200
User-agent: KMail/1.5

Hi,

tar-1.14.90 now uses argp. And in a German locale, its "tar --help" output
looks like this:

$ tar --help
Usage: tar [OPTION...] [FILE]...
....
....
 Archive format selection:

  -H, --format=FORMAT        create archive of the given format.

  Project-Id-Version: tar 1.13.25
Report-Msgid-Bugs-To: address@hidden
POT-Creation-Date: 2004-09-02 16:20+0300
PO-Revision-Date: 2003-08-14 15:58:48+0200
Last-Translator: Michael Piefel <address@hidden>
Language-Team: German <address@hidden>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
                                                          FORMAT is one of the
                             following:

  Project-Id-Version: tar 1.13.25
Report-Msgid-Bugs-To: address@hidden
POT-Creation-Date: 2004-09-02 16:20+0300
PO-Revision-Date: 2003-08-14 15:58:48+0200
Last-Translator: Michael Piefel <address@hidden>
Language-Team: German <address@hidden>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
                                                          posix     POSIX
                             1003.1-2001 (pax) format
  Project-Id-Version: tar 1.13.25
Report-Msgid-Bugs-To: address@hidden
POT-Creation-Date: 2004-09-02 16:20+0300
PO-Revision-Date: 2003-08-14 15:58:48+0200
Last-Translator: Michael Piefel <address@hidden>
Language-Team: German <address@hidden>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
                                                          v7        old V7 tar


What happens here? The repeated text is the German PO file's header entry,
which is returned by gettext(""). Under normal circumstances, programs
shouldn't call gettext(""). Why does tar call it?
1) In src/tar.c there is this code:

  {"format", 'H', N_("FORMAT"), 0,
   N_("create archive of the given format."), 61 },

  {"", 0, NULL, OPTION_DOC, N_("FORMAT is one of the following:"), 62},
  {"", 0, NULL, OPTION_DOC, N_("v7        old V7 tar format"), 63},
  {"", 0, NULL, OPTION_DOC, N_("oldgnu    GNU format as per tar <= 1.12"), 63},
  {"", 0, NULL, OPTION_DOC, N_("gnu       GNU tar 1.13.x format"), 63},
  {"", 0, NULL, OPTION_DOC, N_("ustar     POSIX 1003.1-1988 (ustar) format"), 
63 },
  {"", 0, NULL, OPTION_DOC, N_("posix     POSIX 1003.1-2001 (pax) format"), 63 
},

2) In lib/argp-help.c there is this code:

  if (odoc (real))
    /* A `documentation' option.  */
    {
      __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col);
      for (opt = real, num = entry->num; num > 0; opt++, num--)
        if (opt->name && ovisible (opt))
          {
            comma (uparams.doc_opt_col, &pest);
            /* Calling gettext here isn't quite right, since sorting will
               have been done on the original; but documentation options
               should be pretty rare anyway...  */
            __argp_fmtstream_puts (stream,
                                   dgettext (state->root_argp->argp_domain,
                                             opt->name));
          }
    }

This is confusing:
- Why is argp-help.c translating the opt->name? If, say, an option's
  name is "format" and its German translation is "Formatierung", it
  would not make sense to print "  --Formatierung  " since this is
  not the option that the program accepts.

I propose this fix.

2004-09-11  Bruno Haible  <address@hidden>

        * argp-help.c (hol_entry_help): Don't pass the opt->name of a doc
        option through dgettext.

*** tar-1.14.90.orig/lib/argp-help.c    Tue Aug 17 18:05:19 2004
--- tar-1.14.90/lib/argp-help.c Sat Sep 11 02:06:30 2004
***************
*** 1084,1095 ****
        if (opt->name && ovisible (opt))
          {
            comma (uparams.doc_opt_col, &pest);
!           /* Calling gettext here isn't quite right, since sorting will
!              have been done on the original; but documentation options
!              should be pretty rare anyway...  */
!           __argp_fmtstream_puts (stream,
!                                  dgettext (state->root_argp->argp_domain,
!                                            opt->name));
          }
      }
    else
--- 1084,1092 ----
        if (opt->name && ovisible (opt))
          {
            comma (uparams.doc_opt_col, &pest);
!           /* Don't call gettext here, because opt->name is an untranslatable
!              string, sometimes even the empty string.  */
!           __argp_fmtstream_puts (stream, opt->name);
          }
      }
    else





reply via email to

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