Обсуждение: more message fixes

Поиск
Список
Период
Сортировка

more message fixes

От
Alvaro Herrera
Дата:
Here's a bunch of message fixes in the postgres.po module.  Please
comment if anything seems amiss.  This is not a final patch, since
regression output has not been adjusted; I only verified that the
backend still compiles cleanly.  Some of the changes are going from this
style of message:
  You need an unconditional ON DELETE DO INSTEAD rule with a RETURNING clause.
to this:
  You need an unconditional %s rule with a RETURNING clause.
where the ON DELETE DO INSTEAD part is inserted at execution time, and
can be things like ON UPDATE DO INSTEAD of ON INSERT DO INSTEAD.  If the
reduced string context causes inappropriate changes for any language, I
suppose we shouldn't make this kind of change, but I hope not.

I'm also changing
  "ucnv_fromUChars failed: %s"
to this:
  "%s failed: %s", "ucnv_fromUChars"
so it essentially reduces the number of translated strings, because we
already have "%s failed: %s" in other parts of the backend.  I think
this is not an issue.  Alternatively, we could just remove that message
from translation altogether, and have it emit the English version
always, by changing it from errmsg() to errmsg_internal().

The bulk of the changes are much less interesting that those.

I'm proposing changes in a lot of files:

 src/backend/commands/copy.c             |  6 +++---
 src/backend/commands/publicationcmds.c  |  2 +-
 src/backend/commands/subscriptioncmds.c | 32 ++++++++++++++++++++------------
 src/backend/commands/tablecmds.c        |  9 +++++----
 src/backend/parser/analyze.c            |  2 +-
 src/backend/parser/parse_oper.c         |  1 +
 src/backend/postmaster/postmaster.c     |  7 ++++---
 src/backend/replication/basebackup.c    | 17 +++++++----------
 src/backend/replication/walsender.c     | 20 ++++++++++----------
 src/backend/rewrite/rewriteHandler.c    | 19 +++++++++++++------
 src/backend/utils/adt/jsonpath.c        |  3 ++-
 src/backend/utils/adt/jsonpath_exec.c   |  2 +-
 src/backend/utils/adt/jsonpath_scan.l   | 10 +++++-----
 src/backend/utils/adt/pg_locale.c       | 10 ++++++----
 src/backend/utils/adt/regexp.c          | 14 ++++++++++----
 15 files changed, 89 insertions(+), 65 deletions(-)

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

Вложения

Re: more message fixes

От
Tom Lane
Дата:
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Here's a bunch of message fixes in the postgres.po module.  Please
> comment if anything seems amiss.

These sorts of changes trouble me a bit from a translatability standpoint:

-                     errmsg("connect = false and enabled = true are mutually exclusive options")));
+                     errmsg("%s and %s are mutually exclusive options",
+                            "connect = false", "enabled = true")));

-                        (errmsg("CREATE_REPLICATION_SLOT ... USE_SNAPSHOT "
-                                "must not be called in a subtransaction")));
+                        (errmsg("%s must not be called in a subtransaction",
+                                "CREATE_REPLICATION_SLOT ... USE_SNAPSHOT")));

A translator might expect the %s's to represent single words.
I think at least you'd want a translator: comment to warn about
what the insertion will be.

+            /* XXX is it okay to use %d for BlockNumber everywhere? */

BlockNumber should be %u, no?

            regards, tom lane



Re: more message fixes

От
Alvaro Herrera
Дата:
On 2019-May-15, Tom Lane wrote:

> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > Here's a bunch of message fixes in the postgres.po module.  Please
> > comment if anything seems amiss.
> 
> These sorts of changes trouble me a bit from a translatability standpoint:
> 
> -                     errmsg("connect = false and enabled = true are mutually exclusive options")));
> +                     errmsg("%s and %s are mutually exclusive options",
> +                            "connect = false", "enabled = true")));
> 
> -                        (errmsg("CREATE_REPLICATION_SLOT ... USE_SNAPSHOT "
> -                                "must not be called in a subtransaction")));
> +                        (errmsg("%s must not be called in a subtransaction",
> +                                "CREATE_REPLICATION_SLOT ... USE_SNAPSHOT")));
> 
> A translator might expect the %s's to represent single words.
> I think at least you'd want a translator: comment to warn about
> what the insertion will be.

Fair point, I can add that.  (As a translator, I know I have to
reference the source files more often than I would like.) :-(

> +            /* XXX is it okay to use %d for BlockNumber everywhere? */
> 
> BlockNumber should be %u, no?

Yeah.  It's %d in basebackup.c, hence the comment.  I think technically
it's okay most of the time, because it's only used to reference to block
numbers in a *file*, not a relation; however, I fear it might still
break in cases of a very large --with-segsize option.

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