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.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to