Re: pg_dump.options.diff

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: "Serguei Mokhov" <mokhov(at)cs(dot)concordia(dot)ca>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Subject: Re: pg_dump.options.diff
Date: 2003-01-02 14:29:39
Message-ID: 19899.1041517779@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Manfred Koizar <mkoi-pg(at)aon(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-01-02 14:33:20 Re: Autocommit off and transaction isolation level
Previous Message Charles H. Woloszynski 2003-01-02 12:53:17 Re: Cast your vote ...

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-01-02 14:33:20 Re: Autocommit off and transaction isolation level
Previous Message Michael Paesold 2003-01-02 12:29:07 Autocommit off and transaction isolation level