Re: pg_rewind and log messages

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: pg_rewind and log messages
Дата
Msg-id 20150406130159.GC4369@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: pg_rewind and log messages  (Fujii Masao <masao.fujii@gmail.com>)
Ответы Re: pg_rewind and log messages  (Michael Paquier <michael.paquier@gmail.com>)
Re: pg_rewind and log messages  (Fujii Masao <masao.fujii@gmail.com>)
Список pgsql-hackers
Fujii Masao wrote:
> On Mon, Apr 6, 2015 at 5:33 PM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
> > On Mon, Apr 6, 2015 at 1:41 PM, Michael Paquier wrote:
> >> I guess that you are working on a patch? If not, you are looking for one?
> >
> > Code-speaking, this gives the patch attached.
> 
> Thanks! Here are the review comments:
> 
> I'm not familiar with native language support (sorry), but don't we need to
> add the shortcut of gettext into every calls of pg_log and pg_fatal, e.g.,
> change pg_fatal("xxx") to pg_fatal(_("xxx"))? I know that fprintf() in
> pg_Log_v() has such shortcut, but I'm not sure if that's enough or not.

It's not necessary for pg_fatal and the like, because those functions
are marked to have their first argument automatically translated in
nls.mk.  This means that the string literal is automatically extracted
into pg_rewind.pot for translators.  Of course, the function itself must
call _() (or some variant thereof) to actually fetch the translated
string at run time.

I'm not sure about translation of generic strings such as "%s: %s".  My
first impression is that they shouldn't be translated, but maybe it is
important that they are for languages I don't know nothing about such as
Japanese.

Another thing is compound messages like "foo has happened\nSee --help
for usage.\n" and "bar didn't happen\.See --help for usage".  In those
cases, the "see --help" part would need to be translated over and over,
so it's best to separate them in phrases to avoid repetitive work for
translators.  Not sure how to do this -- maybe something like
_("foo has happened\n") _("See --help")
but I'm not sure how to appease the compiler.  Having them in two
separate pg_log() calls (or whatever) was handy for this reason.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Sawada Masahiko
Дата:
Сообщение: Re: Auditing extension for PostgreSQL (Take 2)
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: TABLESAMPLE patch