Re: pg_rewind and log messages

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_rewind and log messages
Date: 2015-04-07 07:16:10
Message-ID: CAHGQGwHTe5duGwMx2rzBWGZOtzsRUmtycfkgay4x6N1898RazQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 6, 2015 at 10:01 PM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> wrote:
> Fujii Masao wrote:
>> On Mon, Apr 6, 2015 at 5:33 PM, Michael Paquier
>> <michael(dot)paquier(at)gmail(dot)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.

Understood. Thanks!

BTW, as far as I read pg_rewind's nls.mk correctly, it also has two problems.

(1) file_ops.c should be added into GETTEXT_FILES.
(2) pg_log should be pg_log:2 in GETTEXT_TRIGGERS

> 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.

Yep.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2015-04-07 07:33:37 Re: pg_rewind and log messages
Previous Message Shigeru Hanada 2015-04-07 06:53:48 Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)