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?