From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: translatability tweaks
Date: Mon, 22 Apr 2019 16:15:08 -0400
Message-ID: <20190422201507.GA1821@alvherre.pgsql> (raw)
Here's a small number of translatability tweaks to the error messages in
the backend. I found these while updating the Spanish translation over
the past weekend, a task I had neglected for two or three years, so they
might involve some older messages. However, I won't backpatch this --
only apply to pg12 tomorrow or so.
(I haven't yet gone over the full backend message catalog yet, so I
might propose more fixes later on.)
--
Álvaro Herrera http://www.twitter.com/alvherreAttachments:0001-Unify-error-messages.patch (text/x-diff, 6.0K) download
From 091d4043aca3fa4936f1020b635a78e8b6d9010d Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Mon, 22 Apr 2019 15:45:06 -0400
Subject: [PATCH] Unify error messages
... for translatability purposes.
---
src/backend/storage/ipc/latch.c | 12 +++++++++---
src/backend/storage/ipc/signalfuncs.c | 4 +++-
src/backend/utils/adt/formatting.c | 9 ++++++---
src/backend/utils/adt/genfile.c | 4 +++-
src/backend/utils/adt/json.c | 4 +++-
src/backend/utils/adt/jsonb.c | 4 +++-
6 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.cindex 59fa917ae04..e0712f906a1 100644--- a/src/backend/storage/ipc/latch.c+++ b/src/backend/storage/ipc/latch.c@@ -856,7 +856,9 @@ WaitEventAdjustEpoll(WaitEventSet *set, WaitEvent *event, int action)
if (rc < 0)
ereport(ERROR,
(errcode_for_socket_access(),
- errmsg("epoll_ctl() failed: %m")));+ /* translator: %s is a syscall name, such as "poll()" */+ errmsg("%s failed: %m",+ "epoll_ctl()")));
}
#endif
@@ -1087,7 +1089,9 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout,
waiting = false;
ereport(ERROR,
(errcode_for_socket_access(),
- errmsg("epoll_wait() failed: %m")));+ /* translator: %s is a syscall name, such as "poll()" */+ errmsg("%s failed: %m",+ "epoll_wait()")));
}
return 0;
}
@@ -1211,7 +1215,9 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout,
waiting = false;
ereport(ERROR,
(errcode_for_socket_access(),
- errmsg("poll() failed: %m")));+ /* translator: %s is a syscall name, such as "poll()" */+ errmsg("%s failed: %m",+ "poll()")));
}
return 0;
}
diff --git a/src/backend/storage/ipc/signalfuncs.c b/src/backend/storage/ipc/signalfuncs.cindex 4769b1b51eb..4bfbd57464c 100644--- a/src/backend/storage/ipc/signalfuncs.c+++ b/src/backend/storage/ipc/signalfuncs.c@@ -181,7 +181,9 @@ pg_rotate_logfile(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to rotate log files with adminpack 1.0"),
- errhint("Consider using pg_logfile_rotate(), which is part of core, instead."))));+ /* translator: %s is a SQL function name */+ errhint("Consider using %s, which is part of core, instead.",+ "pg_logfile_rotate()"))));
if (!Logging_collector)
{
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.cindex df1db7bc9f1..69a691f18e7 100644--- a/src/backend/utils/adt/formatting.c+++ b/src/backend/utils/adt/formatting.c@@ -1566,7 +1566,8 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
*/
ereport(ERROR,
(errcode(ERRCODE_INDETERMINATE_COLLATION),
- errmsg("could not determine which collation to use for lower() function"),+ errmsg("could not determine which collation to use for %s function",+ "lower()"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
mylocale = pg_newlocale_from_collation(collid);
@@ -1688,7 +1689,8 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
*/
ereport(ERROR,
(errcode(ERRCODE_INDETERMINATE_COLLATION),
- errmsg("could not determine which collation to use for upper() function"),+ errmsg("could not determine which collation to use for %s function",+ "upper()"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
mylocale = pg_newlocale_from_collation(collid);
@@ -1811,7 +1813,8 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
*/
ereport(ERROR,
(errcode(ERRCODE_INDETERMINATE_COLLATION),
- errmsg("could not determine which collation to use for initcap() function"),+ errmsg("could not determine which collation to use for %s function",+ "initcap()"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
mylocale = pg_newlocale_from_collation(collid);
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.cindex d6976609968..a3c6adaf640 100644--- a/src/backend/utils/adt/genfile.c+++ b/src/backend/utils/adt/genfile.c@@ -219,7 +219,9 @@ pg_read_file(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to read files with adminpack 1.0"),
- errhint("Consider using pg_file_read(), which is part of core, instead."))));+ /* translator: %s is a SQL function name */+ errhint("Consider using %s, which is part of core, instead.",+ "pg_file_read()"))));
/* handle optional arguments */
if (PG_NARGS() >= 3)
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.cindex de0d0723b71..bb4bac85f7d 100644--- a/src/backend/utils/adt/json.c+++ b/src/backend/utils/adt/json.c@@ -2192,7 +2192,9 @@ json_build_object(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("argument list must have even number of elements"),
- errhint("The arguments of json_build_object() must consist of alternating keys and values.")));+ /* translator: %s is a SQL function name */+ errhint("The arguments of %s must consist of alternating keys and values.",+ "json_build_object()")));
result = makeStringInfo();
diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.cindex 7af4091200b..036d771386f 100644--- a/src/backend/utils/adt/jsonb.c+++ b/src/backend/utils/adt/jsonb.c@@ -1155,7 +1155,9 @@ jsonb_build_object(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("argument list must have even number of elements"),
- errhint("The arguments of jsonb_build_object() must consist of alternating keys and values.")));+ /* translator: %s is a SQL function name */+ errhint("The arguments of %s must consist of alternating keys and values.",+ "jsonb_build_object()")));
memset(&result, 0, sizeof(JsonbInState));
--
2.17.1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
Subject: Re: translatability tweaks
In-Reply-To: <20190422201507.GA1821@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox