Re: Internationalized error messages

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Internationalized error messages
Дата
Msg-id Pine.LNX.4.30.0103091643350.929-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: Internationalized error messages  (ncm@zembu.com (Nathan Myers))
Список 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@gmx.net       http://yi.org/peter-e/



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: AW: WAL does not recover gracefully from out-of-disk-sp ace
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Internationalized error messages