Re: Better title output for psql \dt \di etc. commands

2025-02-05 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > On 2025-Feb-04, Tom Lane wrote: >> The implementation I had in mind was to just invent a >> pg_log_error_internal() macro alias for pg_log_error(). >> That'd take about two lines counting the explanatory comment. >> This approach would fail to suppress the

Re: Better title output for psql \dt \di etc. commands

2025-02-05 Thread Álvaro Herrera
On 2025-Feb-04, Tom Lane wrote: > The implementation I had in mind was to just invent a > pg_log_error_internal() macro alias for pg_log_error(). > That'd take about two lines counting the explanatory comment. > This approach would fail to suppress the cost of gettext's > trying to look up the str

Re: Better title output for psql \dt \di etc. commands

2025-02-04 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > On 2025-Feb-04, Tom Lane wrote: >> =?utf-8?Q?=C3=81lvaro?= Herrera writes: >>> At this point I would just add a "translator:" comment that explains >>> that the ??? bit is for unexpected cases and can be translated in the >>> same way. >> Hmm, do we have

Re: Better title output for psql \dt \di etc. commands

2025-02-04 Thread Álvaro Herrera
On 2025-Feb-04, Tom Lane wrote: > =?utf-8?Q?=C3=81lvaro?= Herrera writes: > > At this point I would just add a "translator:" comment that explains > > that the ??? bit is for unexpected cases and can be translated in the > > same way. > > Hmm, do we have a standard policy or comment wording abou

Re: Better title output for psql \dt \di etc. commands

2025-02-04 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > At this point I would just add a "translator:" comment that explains > that the ??? bit is for unexpected cases and can be translated in the > same way. Hmm, do we have a standard policy or comment wording about that? I looked for "translator: ... unexpec

Re: Better title output for psql \dt \di etc. commands

2025-02-04 Thread Álvaro Herrera
On 2025-Feb-03, Tom Lane wrote: > One problem with it is that while we can leave "List of ???" out > of the set of translatable strings easily, we can't currently > do that for the argument of pg_log_error because it's automatically > a gettext trigger. I'd rather not burden translators with figu

Re: Better title output for psql \dt \di etc. commands

2025-02-03 Thread Tom Lane
Greg Sabino Mullane writes: > ... For this > particular item, I'm still of the opinion that leaving it as "List of > relations" is a pretty good default for some future somebody who forgets to > update the lists of relation types. New types are certainly not going to > happen often. Better "List o

Re: Better title output for psql \dt \di etc. commands

2025-02-03 Thread Greg Sabino Mullane
On Mon, Feb 3, 2025 at 5:38 PM Tom Lane wrote: > One problem with it is that while we can leave "List of ???" out of the > set of translatable strings easily, we can't currently do that for the > argument of pg_log_error because it's automatically a gettext trigger. I'd > rather not burden trans

Re: Better title output for psql \dt \di etc. commands

2025-02-03 Thread Tom Lane
Greg Sabino Mullane writes: > I like the ntypes idea: please find attached version 3 which implements it. > I wrote it slightly differently as I did not want to leave any chance of it > escaping the if else blocks without a match. Hmm, I was envisioning being a little more in-your-face about the

Re: Better title output for psql \dt \di etc. commands

2025-02-03 Thread Greg Sabino Mullane
I like the ntypes idea: please find attached version 3 which implements it. I wrote it slightly differently as I did not want to leave any chance of it escaping the if else blocks without a match. Cheers, Greg -- Crunchy Data - https://www.crunchydata.com Enterprise Postgres Software Products & T

Re: Better title output for psql \dt \di etc. commands

2025-02-03 Thread Nathan Bossart
On Mon, Feb 03, 2025 at 03:12:57PM -0500, Tom Lane wrote: > Greg Sabino Mullane writes: >> I toyed with that for a bit, but as you say, without generating a ton of >> combinations to translate, we'd have to fall back on run-time >> constructions. Neither is ideal. I also realized that I almost nev

Re: Better title output for psql \dt \di etc. commands

2025-02-03 Thread Tom Lane
Greg Sabino Mullane writes: > I toyed with that for a bit, but as you say, without generating a ton of > combinations to translate, we'd have to fall back on run-time > constructions. Neither is ideal. I also realized that I almost never type > "\dti". Very common for me are \d and \dt and \dv etc

Re: Better title output for psql \dt \di etc. commands

2025-02-03 Thread Greg Sabino Mullane
On Mon, Feb 3, 2025 at 1:07 PM Tom Lane wrote: > As presented, I think this fails the translatability guideline Thanks, good point. Please find attached a slightly more verbose version that should be better for translations. For myself, if we were going to do something like this, I'd kind of

Re: Better title output for psql \dt \di etc. commands

2025-02-03 Thread Tom Lane
Greg Sabino Mullane writes: > Please find attached a patch to enable more intuitive titles when using > psql and doing the following actions: > \dt \di \dv \dm \ds \dE > In other words, everything in listTables() > We still default to "List or relations", but if we know that the user has > request