Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group