Manfred Koizar <[EMAIL PROTECTED]> writes:
> Just another way to do it:

> #define xo explain_option
>       xo("f", "file", "FILENAME", "output file name");

Perhaps better would be:

#if defined(HAVE_GETOPT_LONG)
#define xo(long,short,desc)  printf("%-27s %s\n", long, desc)
#else
#define xo(long,short,desc)  printf("%-27s %s\n", short, desc)
#endif

        xo(_("-f, --file=FILENAME"),
           _("-f FILENAME"),
           _("output file name"));

which avoids putting a lot of "smarts" (read: restrictions) into the
subroutine, but still keeps most of the other benefits, including:
* keeping the segments of the description together in the source code,
  and rationally organized from a translation standpoint;
* only one place to change to adjust the column width.

Although it occurs to me that with the existing setup, it's possible
for the translator to unilaterally alter the column width for the
switches, which is something he'd definitely like to be able to do.
Maybe we should not try to be cute, but just do

#if defined(HAVE_GETOPT_LONG)
#define xo(long,short,desc)  printf("%s %s\n", long, desc)
#else
#define xo(long,short,desc)  printf("%s %s\n", short, desc)
#endif

        xo(_("-f, --file=FILENAME    "),
           _("-f FILENAME            "),
           _("output file name"));

so that the column spacing remains under control of the translator.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to