Re: pg_dump.options.diff - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_dump.options.diff
Date
Msg-id 19899.1041517779@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_dump.options.diff  (Manfred Koizar <mkoi-pg@aon.at>)
List pgsql-hackers
Manfred Koizar <mkoi-pg@aon.at> 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


pgsql-hackers by date:

Previous
From: Dan Langille
Date:
Subject: Re: PostgreSQL Password Cracker
Next
From: Tom Lane
Date:
Subject: Re: Autocommit off and transaction isolation level