]> granicus.if.org Git - postgresql/commitdiff
Message wording and pluralization improvements
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 18 May 2018 03:05:27 +0000 (23:05 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 18 May 2018 03:05:27 +0000 (23:05 -0400)
src/backend/access/transam/xlog.c
src/backend/bootstrap/bootstrap.c
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_receivewal.c
src/bin/pg_basebackup/streamutil.c
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_resetwal/pg_resetwal.c
src/bin/pg_rewind/pg_rewind.c
src/bin/pg_upgrade/pg_upgrade.c
src/bin/pg_waldump/pg_waldump.c

index c633e111281e9c6cac58009309d4bca5d8e4b798..04bfac748587b45ad127386df5943b140599c5c4 100644 (file)
@@ -4652,8 +4652,10 @@ ReadControlFile(void)
 
        if (!IsValidWalSegSize(wal_segment_size))
                ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                                               errmsg("WAL segment size must be a power of two between 1MB and 1GB, but the control file specifies %d bytes",
-                                                          wal_segment_size)));
+                                               errmsg_plural("WAL segment size must be a power of two between 1 MB and 1 GB, but the control file specifies %d byte",
+                                                                         "WAL segment size must be a power of two between 1 MB and 1 GB, but the control file specifies %d bytes",
+                                                                         wal_segment_size,
+                                                                         wal_segment_size)));
 
        snprintf(wal_segsz_str, sizeof(wal_segsz_str), "%d", wal_segment_size);
        SetConfigOption("wal_segment_size", wal_segsz_str, PGC_INTERNAL,
index a148bdc9fd32d699a614f9e5ca480e01d80ef1d3..7e34bee63e0f5e238dcb96b8bb42e1c0043db70e 100644 (file)
@@ -265,7 +265,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
                                        if (!IsValidWalSegSize(WalSegSz))
                                                ereport(ERROR,
                                                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                                                                errmsg("-X requires a power of 2 value between 1MB and 1GB")));
+                                                                errmsg("-X requires a power of two value between 1 MB and 1 GB")));
                                        SetConfigOption("wal_segment_size", optarg, PGC_INTERNAL,
                                                                        PGC_S_OVERRIDE);
                                }
index 58f780c0691249bf30f0f5e99d6bdd326b126dfe..fb5b51d6bea17e5c04ac962b4228b290a078ed20 100644 (file)
@@ -2418,8 +2418,8 @@ main(int argc, char **argv)
                if (!replication_slot)
                {
                        fprintf(stderr,
-                                       _("%s: --create-slot needs a slot to be specified using --slot\n"),
-                                       progname);
+                                       _("%s: %s needs a slot to be specified using --slot\n"),
+                                       progname, "--create-slot");
                        fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
                                        progname);
                        exit(1);
index 535355ebdad28cbc44cece4f0cebcfc6676d07f9..071b32d19da791b7e917df8a2dc705282f47f56b 100644 (file)
@@ -120,7 +120,7 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
        if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos)
        {
                if (verbose)
-                       fprintf(stderr, _("%s: stopped streaming at %X/%X (timeline %u)\n"),
+                       fprintf(stderr, _("%s: stopped log streaming at %X/%X (timeline %u)\n"),
                                        progname, (uint32) (xlogpos >> 32), (uint32) xlogpos,
                                        timeline);
                time_to_stop = true;
index 820d1a61df5272f86148e46679e66088926cb4b5..52f1e559b7464f62228d65b213eb6a78aaff9ae7 100644 (file)
@@ -336,7 +336,9 @@ RetrieveWalSegSize(PGconn *conn)
        if (!IsValidWalSegSize(WalSegSz))
        {
                fprintf(stderr,
-                               _("%s: WAL segment size must be a power of two between 1MB and 1GB, but the remote server reported a value of %d bytes\n"),
+                               ngettext("%s: WAL segment size must be a power of two between 1 MB and 1 GB, but the remote server reported a value of %d byte\n",
+                                                "%s: WAL segment size must be a power of two between 1 MB and 1 GB, but the remote server reported a value of %d bytes\n",
+                                                WalSegSz),
                                progname, WalSegSz);
                return false;
        }
index 7d435ffa5786ee2ea1a4aca461d9e03837ded7ee..895a51f89d52110a0c31d1d916f26ffe0cc29432 100644 (file)
@@ -35,9 +35,9 @@ usage(const char *progname)
        printf(_("Usage:\n"));
        printf(_("  %s [OPTION] [DATADIR]\n"), progname);
        printf(_("\nOptions:\n"));
-       printf(_(" [-D,--pgdata=]DATADIR  data directory\n"));
-       printf(_("  -V, --version         output version information, then exit\n"));
-       printf(_("  -?, --help            show this help, then exit\n"));
+       printf(_(" [-D, --pgdata=]DATADIR  data directory\n"));
+       printf(_("  -V, --version          output version information, then exit\n"));
+       printf(_("  -?, --help             show this help, then exit\n"));
        printf(_("\nIf no data directory (DATADIR) is specified, "
                         "the environment variable PGDATA\nis used.\n\n"));
        printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
@@ -174,11 +174,17 @@ main(int argc, char *argv[])
        WalSegSz = ControlFile->xlog_seg_size;
 
        if (!IsValidWalSegSize(WalSegSz))
-               printf(_("WARNING: invalid WAL segment size\n"
-                                "The WAL segment size stored in the file, %d bytes, is not a power of two\n"
-                                "between 1 MB and 1 GB.  The file is corrupt and the results below are\n"
-                                "untrustworthy.\n\n"),
+       {
+               printf(_("WARNING: invalid WAL segment size\n"));
+               printf(ngettext("The WAL segment size stored in the file, %d byte, is not a power of two\n"
+                                               "between 1 MB and 1 GB.  The file is corrupt and the results below are\n"
+                                               "untrustworthy.\n\n",
+                                               "The WAL segment size stored in the file, %d bytes, is not a power of two\n"
+                                               "between 1 MB and 1 GB.  The file is corrupt and the results below are\n"
+                                               "untrustworthy.\n\n",
+                                               WalSegSz),
                           WalSegSz);
+       }
 
        /*
         * This slightly-chintzy coding will work as long as the control file
index 8a0a805f1ed56c567e97feb8cc1b5f7a8d04b5c7..ee28c338f88dde01543af4c5ea9ecec8e47f65cf 100644 (file)
@@ -366,8 +366,8 @@ main(int argc, char *argv[])
        /* Set mask based on PGDATA permissions */
        if (!GetDataDirectoryCreatePerm(DataDir))
        {
-               fprintf(stderr, _("%s: unable to read permissions from \"%s\"\n"),
-                               progname, DataDir);
+               fprintf(stderr, _("%s: could not read permissions of directory \"%s\": %s\n"),
+                               progname, DataDir, strerror(errno));
                exit(1);
        }
 
@@ -655,7 +655,9 @@ ReadControlFile(void)
                if (!IsValidWalSegSize(ControlFile.xlog_seg_size))
                {
                        fprintf(stderr,
-                                       _("%s: pg_control specifies invalid WAL segment size (%d bytes); proceed with caution \n"),
+                                       ngettext("%s: pg_control specifies invalid WAL segment size (%d byte); proceed with caution\n",
+                                                        "%s: pg_control specifies invalid WAL segment size (%d bytes); proceed with caution\n",
+                                                        ControlFile.xlog_seg_size),
                                        progname, ControlFile.xlog_seg_size);
                        return false;
                }
index a1ab13963a7ad38db0817d09a2de2de864841f6e..cabcff5c13b2508cbde438258df910f09083a767 100644 (file)
@@ -189,8 +189,8 @@ main(int argc, char **argv)
        /* Set mask based on PGDATA permissions */
        if (!GetDataDirectoryCreatePerm(datadir_target))
        {
-               fprintf(stderr, _("%s: unable to read permissions from \"%s\"\n"),
-                               progname, datadir_target);
+               fprintf(stderr, _("%s: could not read permissions of directory \"%s\": %s\n"),
+                               progname, datadir_target, strerror(errno));
                exit(1);
        }
 
@@ -648,7 +648,9 @@ digestControlFile(ControlFileData *ControlFile, char *src, size_t size)
        WalSegSz = ControlFile->xlog_seg_size;
 
        if (!IsValidWalSegSize(WalSegSz))
-               pg_fatal("WAL segment size must be a power of two between 1MB and 1GB, but the control file specifies %d bytes\n",
+               pg_fatal(ngettext("WAL segment size must be a power of two between 1 MB and 1 GB, but the control file specifies %d byte\n",
+                                                 "WAL segment size must be a power of two between 1 MB and 1 GB, but the control file specifies %d bytes\n",
+                                                 WalSegSz),
                                 WalSegSz);
 
        /* Additional checks on control file */
index 9b2d37f9171867a833fd2c92ffddbf89048bd110..9fc364bf5ccc6ae93511f1972b6c226636e38bd2 100644 (file)
@@ -103,8 +103,8 @@ main(int argc, char **argv)
        /* Set mask based on PGDATA permissions */
        if (!GetDataDirectoryCreatePerm(new_cluster.pgdata))
        {
-               pg_log(PG_FATAL, "unable to read permissions from \"%s\"\n",
-                          new_cluster.pgdata);
+               pg_log(PG_FATAL, "could not read permissions of directory \"%s\": %s\n",
+                          new_cluster.pgdata, strerror(errno));
                exit(1);
        }
 
index 242aff2d6814b4a9d4dc837f647b5350fdafabd3..5c4f38e59713acb84b8c671ea96f6c98005bd64a 100644 (file)
@@ -218,7 +218,9 @@ search_directory(const char *directory, const char *fname)
                        WalSegSz = longhdr->xlp_seg_size;
 
                        if (!IsValidWalSegSize(WalSegSz))
-                               fatal_error("WAL segment size must be a power of two between 1MB and 1GB, but the WAL file \"%s\" header specifies %d bytes",
+                               fatal_error(ngettext("WAL segment size must be a power of two between 1 MB and 1 GB, but the WAL file \"%s\" header specifies %d byte",
+                                                                        "WAL segment size must be a power of two between 1 MB and 1 GB, but the WAL file \"%s\" header specifies %d bytes",
+                                                                        WalSegSz),
                                                        fname, WalSegSz);
                }
                else