Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIfLT-0001Xc-9e for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Apr 2019 20:15:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hIfLS-00020Z-02 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Apr 2019 20:15:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIfLR-00020S-KQ for pgsql-hackers@lists.postgresql.org; Mon, 22 Apr 2019 20:15:17 +0000 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIfLO-0005KZ-1t for pgsql-hackers@lists.postgresql.org; Mon, 22 Apr 2019 20:15:16 +0000 Received: by mail-qt1-x82a.google.com with SMTP id w26so6777953qto.13 for ; Mon, 22 Apr 2019 13:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :content-transfer-encoding:user-agent; bh=p3z65Z2KnBuIyUPwOapTJkLdDGECZs3Ju98zpRK+DZM=; b=OSecQnJoo3MOGmECqxJalisOADtcplz3+ea7jV22rbUaT1YE0iFiPP6oROdQrzrJQD T/QdzQ6gXhDP9fKbTyKUPeuaC6qpHb7NLstaZCJzg6fxop6cOADSlQPXJAFVbXCdBZoO vL4rI9SpNuwfO2jS9x4miKTNJZWoUTdm7gCP8dF1z656yvafgIUKhXCiv0AUhkguWclD diprJW0GwQrR6pOXziqPkyBwrnppvHF0WEfCwO6/YUti68u+ouOt1H/oRHZTM2se0Mch vEhL3oBL6PKJkW7q8ky5rLA7GzpARuX9F9O9VzPtEiZnhOvKc1D3rYoJHBrkb9P9ZebW IZXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=p3z65Z2KnBuIyUPwOapTJkLdDGECZs3Ju98zpRK+DZM=; b=XlejN+jZiv456Gz7pwKhvzxS4qzRd+GcN/uDfovAEykkmmvVJuSj9XK5L4bWCCHRnm S/qIKzxvphmEJWCVkwi0iBpJ9wD8qiBabHCeGCWYQ4XoRgs4J8MuhMX/icoXjYGtKcEF h6zlmR+ar3qxEjvvd5557Av/QtuXJ5VlN4qZ1cQxDotM3Sh/ZvRVlqdXkMz2s21A/VmF b3gTSXADZlgoryI2IS66Jc6a0xPWNmbBUlzErfGlLfIb32NNyAGRxmkMbjRVlARtkv1k ZPLi+JKYWbXa8DkHWeSZvIp5yE9vqnBoYIlp1NPI7FOK0sV6cYs3whfE0pN3u+LoydMV oIbg== X-Gm-Message-State: APjAAAV2/VAcS4YOO900CpnsyyvVRvYG6ERMSlAAQqAtv9CDY9+lvZNO Tvvgtjrx/O8sjDnc2xIslg/eVCBVOxtoZ1jf79CBfXxJQN1MrvDbeikyF0lMLLRe9N0AwXIIBSX n1KZyxx/6889/Jg4471AzCyetWMMNawAHhqEkgRRsPMZnTPsjb6S6DTusNCvI4N9HosPBaWFWD2 aJ6EsSWuGASDJX7Q== X-Google-Smtp-Source: APXvYqwcC0XBc8/rEWp10oJlSZ/9C1oYRHngJ/IbX0VvjThsTd7v3e9y28mY3HpDHdymr9O1SgrUkA== X-Received: by 2002:ac8:1c17:: with SMTP id a23mr3928632qtk.133.1555964111106; Mon, 22 Apr 2019 13:15:11 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id i20sm6817851qkk.70.2019.04.22.13.15.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 13:15:10 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 068EE1207D8; Mon, 22 Apr 2019 16:15:08 -0400 (-04) Date: Mon, 22 Apr 2019 16:15:08 -0400 From: Alvaro Herrera To: Pg Hackers Subject: translatability tweaks Message-ID: <20190422201507.GA1821@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="W/nzBZO5zC0uMSeA" Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --W/nzBZO5zC0uMSeA Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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/alvherre --W/nzBZO5zC0uMSeA Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Unify-error-messages.patch" From 091d4043aca3fa4936f1020b635a78e8b6d9010d Mon Sep 17 00:00:00 2001 From: Alvaro Herrera 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.c index 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.c index 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.c index 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.c index 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.c index 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.c index 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 --W/nzBZO5zC0uMSeA--