Rough draft: easier translation of psql help

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Rough draft: easier translation of psql help
Date: 2009-09-13 21:10:44
Message-ID: 1252876244.26439.18.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

One of the main pains in translating PostgreSQL messages is translating
the SQL syntax synopses in psql. Things like:

msgid ""
"[ WITH [ RECURSIVE ] with_query [, ...] ]\n"
"SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]\n"
" * | expression [ [ AS ] output_name ] [, ...]\n"
" INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table\n"
" [ FROM from_item [, ...] ]\n"
" [ WHERE condition ]\n"
" [ GROUP BY expression [, ...] ]\n"
" [ HAVING condition [, ...] ]\n"
" [ WINDOW window_name AS ( window_definition ) [, ...] ]\n"
" [ { UNION | INTERSECT | EXCEPT } [ ALL ] select ]\n"
" [ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS
{ FIRST | "
"LAST } ] [, ...] ]\n"
" [ LIMIT { count | ALL } ]\n"
" [ OFFSET start [ ROW | ROWS ] ]\n"
" [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]\n"
" [ FOR { UPDATE | SHARE } [ OF table_name [, ...] ] [ NOWAIT ]
[...] ]"

Especially when small things are changed from release to release,
figuring this out on the part of the translator is cumbersome and
error-prone.

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.

Comments?

Attachment Content-Type Size
psql-help.patch text/x-patch 6.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2009-09-13 21:17:51 Re: COPY enhancements
Previous Message Hannu Krosing 2009-09-13 20:37:49 Re: RfD: more powerful "any" types