Re: Log message for GSS connection is missing once connection authorization is successful. - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Log message for GSS connection is missing once connection authorization is successful.
Date
Msg-id CALj2ACWwNcjpH04EHeixgx5_LPMaw7Ogx2xYfGJdZpxdKOC0oA@mail.gmail.com
Whole thread Raw
In response to Re: Log message for GSS connection is missing once connection authorization is successful.  (Euler Taveira <euler.taveira@2ndquadrant.com>)
List pgsql-hackers
On Sun, Nov 1, 2020 at 3:34 AM Euler Taveira
<euler.taveira@2ndquadrant.com> wrote:
>
> No. The strings are specified in the appendStringInfo, hence you should add _()
> around the string to be translated. There is nothing to be translated if you
> specify only the format identifier. You can always test if gettext extracts the
> string to be translated by executing 'make update-po' (after specifying
> --enable-nls in the configure).  Search for your string in one of the generated
> files (po/LL.po.new).
>

Thanks a lot for the detailed explanation.

>
> You shouldn't split messages like that because not all languages have the same
> order as English. Having said that you risk providing a nonsense translation
> because someone decided to translate pieces of a sentence separately.
>
> +           appendStringInfo(&logmsg, "replication ");
> +
> +       appendStringInfo(&logmsg, "connection authorized: user=%s",
> +                        port->user_name);
>
> This hunk will break translation. In Portuguese, the adjective "replication" is
> translated after the noun "connection". If you decided to keep this code as is,
> the printed message won't follow the grammar rules. You will have "replicação
> conexão autorizada" instead of "conexão de replicação autorizada". The former
> isn't grammatically correct. Avoid splitting sentences that are translated.
>

Agreed. Looks like we don't break localization rules if we have
something like below, which is done in similar way for a log message
in heap_vacuum_rel(): msgfmt = _("automatic aggressive vacuum to
prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");

   if (am_walsender)
           appendStringInfo(&logmsg, _("replication connection
authorized: user=%s"),
                         port->user_name);
        else
          appendStringInfo(&logmsg, _("connection authorized: user=%s"),
                         port->user_name);

    if (!am_walsender)
        appendStringInfo(&logmsg, _(" database=%s"), port->database_name);

    if (port->application_name != NULL)
        appendStringInfo(&logmsg, _(" application_name=%s"),
                         port->application_name);

#ifdef USE_SSL
    if (port->ssl_in_use)
        appendStringInfo(&logmsg, _(" SSL enabled (protocol=%s,
cipher=%s, bits=%d, compression=%s)"),
                         be_tls_get_version(port),
                         be_tls_get_cipher(port),
                         be_tls_get_cipher_bits(port),
                         be_tls_get_compression(port) ? _("on") : _("off"));
#endif
#ifdef ENABLE_GSS
    if (be_gssapi_get_princ(port))
        appendStringInfo(&logmsg, _(" GSS (authenticated=%s,
encrypted=%s, principal=%s)"),
                         be_gssapi_get_auth(port) ? _("yes") : _("no"),
                         be_gssapi_get_enc(port) ? _("yes") : _("no"),
                         be_gssapi_get_princ(port));
#endif

    ereport(LOG, errmsg_internal("%s", logmsg.data));

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: cleanup temporary files after crash
Next
From: Daniil Zakhlystov
Date:
Subject: Re: libpq compression