Commit 9effb63e authored by Peter Eisentraut's avatar Peter Eisentraut

Message wording and pluralization improvements

parent 6b30d138
...@@ -4652,7 +4652,9 @@ ReadControlFile(void) ...@@ -4652,7 +4652,9 @@ ReadControlFile(void)
if (!IsValidWalSegSize(wal_segment_size)) if (!IsValidWalSegSize(wal_segment_size))
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), 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", 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))); wal_segment_size)));
snprintf(wal_segsz_str, sizeof(wal_segsz_str), "%d", wal_segment_size); snprintf(wal_segsz_str, sizeof(wal_segsz_str), "%d", wal_segment_size);
......
...@@ -265,7 +265,7 @@ AuxiliaryProcessMain(int argc, char *argv[]) ...@@ -265,7 +265,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
if (!IsValidWalSegSize(WalSegSz)) if (!IsValidWalSegSize(WalSegSz))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (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, SetConfigOption("wal_segment_size", optarg, PGC_INTERNAL,
PGC_S_OVERRIDE); PGC_S_OVERRIDE);
} }
......
...@@ -2418,8 +2418,8 @@ main(int argc, char **argv) ...@@ -2418,8 +2418,8 @@ main(int argc, char **argv)
if (!replication_slot) if (!replication_slot)
{ {
fprintf(stderr, fprintf(stderr,
_("%s: --create-slot needs a slot to be specified using --slot\n"), _("%s: %s needs a slot to be specified using --slot\n"),
progname); progname, "--create-slot");
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname); progname);
exit(1); exit(1);
......
...@@ -120,7 +120,7 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished) ...@@ -120,7 +120,7 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos) if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos)
{ {
if (verbose) 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, progname, (uint32) (xlogpos >> 32), (uint32) xlogpos,
timeline); timeline);
time_to_stop = true; time_to_stop = true;
......
...@@ -336,7 +336,9 @@ RetrieveWalSegSize(PGconn *conn) ...@@ -336,7 +336,9 @@ RetrieveWalSegSize(PGconn *conn)
if (!IsValidWalSegSize(WalSegSz)) if (!IsValidWalSegSize(WalSegSz))
{ {
fprintf(stderr, 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); progname, WalSegSz);
return false; return false;
} }
......
...@@ -35,7 +35,7 @@ usage(const char *progname) ...@@ -35,7 +35,7 @@ usage(const char *progname)
printf(_("Usage:\n")); printf(_("Usage:\n"));
printf(_(" %s [OPTION] [DATADIR]\n"), progname); printf(_(" %s [OPTION] [DATADIR]\n"), progname);
printf(_("\nOptions:\n")); printf(_("\nOptions:\n"));
printf(_(" [-D,--pgdata=]DATADIR data directory\n")); printf(_(" [-D, --pgdata=]DATADIR data directory\n"));
printf(_(" -V, --version output version information, then exit\n")); printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n")); printf(_(" -?, --help show this help, then exit\n"));
printf(_("\nIf no data directory (DATADIR) is specified, " printf(_("\nIf no data directory (DATADIR) is specified, "
...@@ -174,11 +174,17 @@ main(int argc, char *argv[]) ...@@ -174,11 +174,17 @@ main(int argc, char *argv[])
WalSegSz = ControlFile->xlog_seg_size; WalSegSz = ControlFile->xlog_seg_size;
if (!IsValidWalSegSize(WalSegSz)) if (!IsValidWalSegSize(WalSegSz))
printf(_("WARNING: invalid WAL segment size\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" "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" "between 1 MB and 1 GB. The file is corrupt and the results below are\n"
"untrustworthy.\n\n"), "untrustworthy.\n\n",
WalSegSz),
WalSegSz); WalSegSz);
}
/* /*
* This slightly-chintzy coding will work as long as the control file * This slightly-chintzy coding will work as long as the control file
......
...@@ -366,8 +366,8 @@ main(int argc, char *argv[]) ...@@ -366,8 +366,8 @@ main(int argc, char *argv[])
/* Set mask based on PGDATA permissions */ /* Set mask based on PGDATA permissions */
if (!GetDataDirectoryCreatePerm(DataDir)) if (!GetDataDirectoryCreatePerm(DataDir))
{ {
fprintf(stderr, _("%s: unable to read permissions from \"%s\"\n"), fprintf(stderr, _("%s: could not read permissions of directory \"%s\": %s\n"),
progname, DataDir); progname, DataDir, strerror(errno));
exit(1); exit(1);
} }
...@@ -655,7 +655,9 @@ ReadControlFile(void) ...@@ -655,7 +655,9 @@ ReadControlFile(void)
if (!IsValidWalSegSize(ControlFile.xlog_seg_size)) if (!IsValidWalSegSize(ControlFile.xlog_seg_size))
{ {
fprintf(stderr, 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); progname, ControlFile.xlog_seg_size);
return false; return false;
} }
......
...@@ -189,8 +189,8 @@ main(int argc, char **argv) ...@@ -189,8 +189,8 @@ main(int argc, char **argv)
/* Set mask based on PGDATA permissions */ /* Set mask based on PGDATA permissions */
if (!GetDataDirectoryCreatePerm(datadir_target)) if (!GetDataDirectoryCreatePerm(datadir_target))
{ {
fprintf(stderr, _("%s: unable to read permissions from \"%s\"\n"), fprintf(stderr, _("%s: could not read permissions of directory \"%s\": %s\n"),
progname, datadir_target); progname, datadir_target, strerror(errno));
exit(1); exit(1);
} }
...@@ -648,7 +648,9 @@ digestControlFile(ControlFileData *ControlFile, char *src, size_t size) ...@@ -648,7 +648,9 @@ digestControlFile(ControlFileData *ControlFile, char *src, size_t size)
WalSegSz = ControlFile->xlog_seg_size; WalSegSz = ControlFile->xlog_seg_size;
if (!IsValidWalSegSize(WalSegSz)) 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); WalSegSz);
/* Additional checks on control file */ /* Additional checks on control file */
......
...@@ -103,8 +103,8 @@ main(int argc, char **argv) ...@@ -103,8 +103,8 @@ main(int argc, char **argv)
/* Set mask based on PGDATA permissions */ /* Set mask based on PGDATA permissions */
if (!GetDataDirectoryCreatePerm(new_cluster.pgdata)) if (!GetDataDirectoryCreatePerm(new_cluster.pgdata))
{ {
pg_log(PG_FATAL, "unable to read permissions from \"%s\"\n", pg_log(PG_FATAL, "could not read permissions of directory \"%s\": %s\n",
new_cluster.pgdata); new_cluster.pgdata, strerror(errno));
exit(1); exit(1);
} }
......
...@@ -218,7 +218,9 @@ search_directory(const char *directory, const char *fname) ...@@ -218,7 +218,9 @@ search_directory(const char *directory, const char *fname)
WalSegSz = longhdr->xlp_seg_size; WalSegSz = longhdr->xlp_seg_size;
if (!IsValidWalSegSize(WalSegSz)) 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); fname, WalSegSz);
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment