Re: Patch to allow users to kill their own queries - Mailing list pgsql-hackers

From Noah Misch
Subject Re: Patch to allow users to kill their own queries
Date
Msg-id 20120103165438.GB9769@tornado.leadboat.com
Whole thread Raw
In response to Re: Patch to allow users to kill their own queries  (Magnus Hagander <magnus@hagander.net>)
Responses Re: Patch to allow users to kill their own queries  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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.


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: ALTER TABLE lock strength reduction patch is unsafe
Next
From: Kohei KaiGai
Date:
Subject: Re: [v9.2] Fix Leaky View Problem