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@gmx.net http://yi.org/peter-e/