pg_upgrade: prep_status doesn't translate messages

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

pg_upgrade: prep_status doesn't translate messages

Horiguchi Kyotaro
Hello.

In pg_upgrade, prep statuts is shown in English even if LANG is
set to other languages.

$ LANG=ja_JP.UTF8 pg_upgrade ...
<"Performing Consistency Checks on Old Live Server" in Japanese>
--------------------------------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
...
<"*Clusters are compatible*" in Japanese>


prep_status is marked as GETTEXT_TRIGGERS but actually doesn't
translate. I suppose the reason is we don't have a general and
portable means to align the message strings containing non-ascii
characters.

I'd like to propose to append " ... " instead of aligning messages.

Checking cluster versions ... ok
Checking database user is the install user ... ok
Checking database connection settings ... ok
Checking for prepared transactions ... ok

If we don't do that, translation lines in po files are
useless. prep_stauts must be removed from TETTEXT_TRIGGERS, and a
comment that explains the reason for not translating.

Any opinions?

regardes.


--
Kyotaro Horiguchi
NTT Open Source Software Center

0001-Change-format-of-prep-status-of-pg_upgrade.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: pg_upgrade: prep_status doesn't translate messages

Michael Paquier-2
On Mon, Jun 10, 2019 at 01:57:14PM +0900, Kyotaro Horiguchi wrote:
> If we don't do that, translation lines in po files are
> useless. prep_stauts must be removed from TETTEXT_TRIGGERS, and a
> comment that explains the reason for not translating.
>
> Any opinions?

I agree with your point that it should be an all-or-nothing, and not
something in the middle.  Now, I would fall into the category of
people which would prefer making the full set of contents translated,
and there has been some work in this area recently:
https://www.postgresql.org/message-id/20170523002827.lzc2jkzh2gubclqb@...
--
Michael

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: pg_upgrade: prep_status doesn't translate messages

Horiguchi Kyotaro
Hello.

At Mon, 10 Jun 2019 16:48:42 +0900, Michael Paquier
<[hidden email]> wrote in <[hidden email]>

> On Mon, Jun 10, 2019 at 01:57:14PM +0900, Kyotaro Horiguchi wrote:
> > If we don't do that, translation lines in po files are
> > useless. prep_stauts must be removed from TETTEXT_TRIGGERS, and a
> > comment that explains the reason for not translating.
> >
> > Any opinions?
>
> I agree with your point that it should be an all-or-nothing, and not
> something in the middle.  Now, I would fall into the category of
> people which would prefer making the full set of contents translated,

I'm on the same side. Whether do you think this as a 12-issue or
for later versions? I think there is no risk in changing it now so
I wish the change is contained in 12-shipping.


> and there has been some work in this area recently:
> https://www.postgresql.org/message-id/20170523002827.lzc2jkzh2gubclqb@...

Thanks for the pointer. I'm seeing the result of the discussion
now. Apart from the discussion of translate-or-not decision,
there can be a discussion how we can reduce the burden of
translation work. I was a bit tired to translate something like
the followings:

old and new pg_controldata block sizes are invalid or do not match
old and new pg_controldata maximum relation segment sizes are invalid
or do not match
old and new pg_controldata WAL block sizes are invalid or do not match
...

I'm not sure where is the compromisable point between burden of
translators and programmers, though.

regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center


Reply | Threaded
Open this post in threaded view
|

Re: pg_upgrade: prep_status doesn't translate messages

Alvaro Herrera-9
On 2019-Jun-11, Kyotaro Horiguchi wrote:

> Thanks for the pointer. I'm seeing the result of the discussion
> now. Apart from the discussion of translate-or-not decision,
> there can be a discussion how we can reduce the burden of
> translation work. I was a bit tired to translate something like
> the followings:
>
> old and new pg_controldata block sizes are invalid or do not match
> old and new pg_controldata maximum relation segment sizes are invalid
> or do not match
> old and new pg_controldata WAL block sizes are invalid or do not match
> ...
>
> I'm not sure where is the compromisable point between burden of
> translators and programmers, though.

I think the problem with those messages is that they are poorly
worded/styled, but I haven't tried to figure out how to make them
better.  That may also fix the translation burden, not sure.  If you
have proposals for improvement, let's hear them.

Here's a quick idea. We already have this:

msgid "The target cluster lacks some required control information:\n"
msgid "  checkpoint next XID\n"
msgid "  latest checkpoint next OID\n"

so this gives me the idea that one way to fix the problem you mention is
something like this:

msgid "The following source and target pg_controldata items do not match:"
msgid "  block size"
msgid "  maximum relation segment size"

etc.  (One thing to note is that those strings already exist in the .po
files, so already translated).  Obviously needs a bit of code rework
(and the first new one should use the plural stuff, because it's likely
it'll only be one item that does not match).  Also will need separate
messages (with plurals) for

msgid "The following source pg_controldata items are invalid:"
msgid "The following target pg_controldata items are invalid:"

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


Reply | Threaded
Open this post in threaded view
|

Re: pg_upgrade: prep_status doesn't translate messages

Horiguchi Kyotaro
Hello.

On Tue, Jun 11, 2019 at 11:11 PM Alvaro Herrera
<[hidden email]> wrote:
> I think the problem with those messages is that they are poorly
> worded/styled, but I haven't tried to figure out how to make them
> better.  That may also fix the translation burden, not sure.  If you
> have proposals for improvement, let's hear them.

I didn't think so deeply. What I had in mind at the time was
splitting-out of the variable part from template part, as we have many
existing examples.

> Here's a quick idea. We already have this:
>
> msgid "The target cluster lacks some required control information:\n"
> msgid "  checkpoint next XID\n"
> msgid "  latest checkpoint next OID\n"

== By the way,

I found a similar but to-exit message:

controldata.c:175
|      if (cluster == &old_cluster)
|        pg_fatal("The source cluster lacks cluster state information:\n");

The colon should be a period?

== END OF "By the way"

> so this gives me the idea that one way to fix the problem you mention is
> something like this:
>
> msgid "The following source and target pg_controldata items do not match:"
> msgid "  block size"
> msgid "  maximum relation segment size"
> etc.  (One thing to note is that those strings already exist in the .po
> files, so already translated).  Obviously needs a bit of code rework

Each of the message is pg_fatal'ed. So the following insated will
work:

pg_fatal("The source and target pg_controldata item do not match:%s",
      _("  maximum alignment\n"));

That seems closer to the the guideline. (But I don't think
"[SP][SP]maximum[SP]alignment\n" is not proper as a translation unit..)

> (and the first new one should use the plural stuff, because it's likely
> it'll only be one item that does not match).  Also will need separate
> messages (with plurals) for
>
> msgid "The following source pg_controldata items are invalid:"
> msgid "The following target pg_controldata items are invalid:"

Something like the attached works that way.

By the way I'm a bit annoyed also by the (seemingly) random occurrence
of "old/new" and "source/target".

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

PoC_pg_upgrade_controldata_error_refactor.patch (5K) Download Attachment