Re: Internationalized error messages

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Internationalized error messages
Date: 2001-03-09 15:45:54
Message-ID: Pine.LNX.4.30.0103091643350.929-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Nathan Myers writes:

> > elog(ERROR, "XYZ01", gettext("stuff happened"));
>
> Similar approaches have been tried frequently, and even enshrined
> in standards (e.g. POSIX catgets), but have almost always proven too
> cumbersome. The problem is that keeping programs that interpret the
> numeric code in sync with the program they monitor is hard, and trying
> to avoid breaking all those secondary programs hinders development on
> the primary program.

That's why no one uses catgets and everyone uses gettext.

> Furthermore, assigning code numbers is a nuisance, and they add
> uninformative clutter.

The error codes are exactly what we want, to allow client programs (as
opposed to humans) to identify the errors. The code in my example has
nothing to do with the message id in the catgets interface.

> It's better to scan the program for elog() arguments, and generate
> a catalog by using the string itself as the index code. Those
> maintaining the secondary programs can compare catalogs to see what
> has been broken by changes and what new messages to expect. elog()
> itself can (optionally) invent tokens (e.g. catalog indices) to help
> out those programs.

That's what gettext does for you.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-03-09 15:57:18 Re: Internationalized error messages
Previous Message Tom Lane 2001-03-09 15:07:13 Re: AW: WAL does not recover gracefully from out-of-disk-sp ace