From: | Noah Misch <noah(at)leadboat(dot)com> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | Greg Smith <greg(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Patch to allow users to kill their own queries |
Date: | 2012-01-03 16:54:38 |
Message-ID: | 20120103165438.GB9769@tornado.leadboat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Dec 20, 2011 at 02:30:08PM +0100, Magnus Hagander wrote:
> That said - can someone who knows the translation stuff better than me
> comment on if this is actually going to be translatable, or if it
> violates too many translation rules?
> +pg_signal_backend(int pid, int sig, bool allow_same_role, const char *actionstr, const char *hint)
> + ereport(ERROR,
> + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
> + errmsg("must be superuser to %s other server processes", actionstr),
> + errhint("%s", hint)));
> + PG_RETURN_BOOL(pg_signal_backend(PG_GETARG_INT32(0), SIGTERM, false,
> + gettext_noop("terminate"),
> + gettext_noop("You can cancel your own processes with pg_cancel_backend().")));
> }
You need "errhint("%s", _(hint))" or "errhint(hint)" to substitute the
translation at runtime; only the printf-pattern string gets an automatic
message catalog lookup.
Regarding the other message, avoid composing a translated message from
independently-translated parts. The translator sees this:
#: utils/adt/misc.c:110
#, c-format
msgid "must be superuser to %s other server processes"
msgstr ""
#: utils/adt/misc.c:166
msgid "terminate"
msgstr ""
#: utils/adt/misc.c:167
msgid "You can cancel your own processes with pg_cancel_backend()."
msgstr ""
He'll probably need to read the code to see how the strings go together. If
we add an alternative to "terminate", not all languages will necessarily have
a translation of the outer message that works for both inner fragments.
From | Date | Subject | |
---|---|---|---|
Next Message | Kohei KaiGai | 2012-01-03 17:11:39 | Re: [v9.2] Fix Leaky View Problem |
Previous Message | Simon Riggs | 2012-01-03 16:17:26 | Re: ALTER TABLE lock strength reduction patch is unsafe |