Re: Rough draft: easier translation of psql help

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Rough draft: easier translation of psql help
Date: 2009-09-13 22:25:46
Message-ID: 25210.1252880746@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Instead of translating the whole string, that is (picking a shorter
> example)

> N_("ALTER TEXT SEARCH PARSER name RENAME TO newname")

> we really only want to translate the placeholders, so it could look like
> this:

> appendPQExpBuffer(buf,
> "ALTER TEXT SEARCH PARSER %s RENAME TO %s",
> _("name"),
> _("newname"));

> This is what the attached patch produces.

Seems like a reasonable idea.

> Comments?

I'm not sure what the "const" here is good for, and I can think of
some compilers that are likely to get confused too:

> + void (* const syntaxfunc)(PQExpBuffer); /* function that prints the syntax associated with it */

Also, are you sure that code to identify the placeholders is robust?
Should you be defending against '%' in the syntax string?
Will the NLS infrastructure remember to build sql_help.c before
looking for strings?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua Tolley 2009-09-14 00:11:56 Re: autovacuum_max_workers docs
Previous Message Andrew Dunstan 2009-09-13 22:23:04 Re: [COMMITTERS] pgsql: Add Unicode support in PL/Python