Re: Rough draft: easier translation of psql help - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Rough draft: easier translation of psql help
Date
Msg-id 25210.1252880746@sss.pgh.pa.us
Whole thread Raw
In response to Rough draft: easier translation of psql help  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.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


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [COMMITTERS] pgsql: Add Unicode support in PL/Python
Next
From: Joshua Tolley
Date:
Subject: Re: autovacuum_max_workers docs