Message translatability fixes

This commit is contained in:
Peter Eisentraut 2017-08-25 11:49:05 -04:00
parent d22e9d5305
commit e86ac70d6e
2 changed files with 28 additions and 22 deletions

View File

@ -25,8 +25,9 @@
#define XLOG_BLCKSZ_K (XLOG_BLCKSZ / 1024)
#define LABEL_FORMAT " %-30s"
#define NA_FORMAT "%20s"
#define OPS_FORMAT "%13.3f ops/sec %6.0f usecs/op"
#define NA_FORMAT "%21s\n"
/* translator: maintain alignment with NA_FORMAT */
#define OPS_FORMAT gettext_noop("%13.3f ops/sec %6.0f usecs/op\n")
#define USECS_SEC 1000000
/* These are macros to avoid timing the function call overhead. */
@ -45,7 +46,7 @@ do { \
if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \
INVALID_HANDLE_VALUE) \
{ \
fprintf(stderr, _("Cannot create thread for alarm\n")); \
fprintf(stderr, _("Could not create thread for alarm\n")); \
exit(1); \
} \
gettimeofday(&start_t, NULL); \
@ -191,7 +192,10 @@ handle_args(int argc, char *argv[])
exit(1);
}
printf(_("%d seconds per test\n"), secs_per_test);
printf(ngettext("%d second per test\n",
"%d seconds per test\n",
secs_per_test),
secs_per_test);
#if PG_O_DIRECT != 0
printf(_("O_DIRECT supported on this platform for open_datasync and open_sync.\n"));
#else
@ -255,7 +259,7 @@ test_sync(int writes_per_op)
#ifdef OPEN_DATASYNC_FLAG
if ((tmpfile = open(filename, O_RDWR | O_DSYNC | PG_O_DIRECT, 0)) == -1)
{
printf(NA_FORMAT, _("n/a*\n"));
printf(NA_FORMAT, _("n/a*"));
fs_warning = true;
}
else
@ -273,7 +277,7 @@ test_sync(int writes_per_op)
close(tmpfile);
}
#else
printf(NA_FORMAT, _("n/a\n"));
printf(NA_FORMAT, _("n/a"));
#endif
/*
@ -298,7 +302,7 @@ test_sync(int writes_per_op)
STOP_TIMER;
close(tmpfile);
#else
printf(NA_FORMAT, _("n/a\n"));
printf(NA_FORMAT, _("n/a"));
#endif
/*
@ -346,7 +350,7 @@ test_sync(int writes_per_op)
STOP_TIMER;
close(tmpfile);
#else
printf(NA_FORMAT, _("n/a\n"));
printf(NA_FORMAT, _("n/a"));
#endif
/*
@ -358,7 +362,7 @@ test_sync(int writes_per_op)
#ifdef OPEN_SYNC_FLAG
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1)
{
printf(NA_FORMAT, _("n/a*\n"));
printf(NA_FORMAT, _("n/a*"));
fs_warning = true;
}
else
@ -383,7 +387,7 @@ test_sync(int writes_per_op)
close(tmpfile);
}
#else
printf(NA_FORMAT, _("n/a\n"));
printf(NA_FORMAT, _("n/a"));
#endif
if (fs_warning)
@ -424,7 +428,7 @@ test_open_sync(const char *msg, int writes_size)
#ifdef OPEN_SYNC_FLAG
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1)
printf(NA_FORMAT, _("n/a*\n"));
printf(NA_FORMAT, _("n/a*"));
else
{
START_TIMER;
@ -441,7 +445,7 @@ test_open_sync(const char *msg, int writes_size)
close(tmpfile);
}
#else
printf(NA_FORMAT, _("n/a\n"));
printf(NA_FORMAT, _("n/a"));
#endif
}
@ -577,7 +581,7 @@ print_elapse(struct timeval start_t, struct timeval stop_t, int ops)
double per_second = ops / total_time;
double avg_op_time_us = (total_time / ops) * USECS_SEC;
printf(OPS_FORMAT "\n", per_second, avg_op_time_us);
printf(_(OPS_FORMAT), per_second, avg_op_time_us);
}
#ifndef WIN32

View File

@ -300,7 +300,7 @@ XLogDumpXLogRead(const char *directory, TimeLineID timeline_id,
XLogFileName(fname, timeline_id, sendSegNo);
fatal_error("could not seek in log segment %s to offset %u: %s",
fatal_error("could not seek in log file %s to offset %u: %s",
fname, startoff, strerror(err));
}
sendOff = startoff;
@ -320,7 +320,7 @@ XLogDumpXLogRead(const char *directory, TimeLineID timeline_id,
XLogFileName(fname, timeline_id, sendSegNo);
fatal_error("could not read from log segment %s, offset %d, length %d: %s",
fatal_error("could not read from log file %s, offset %u, length %d: %s",
fname, sendOff, segbytes, strerror(err));
}
@ -710,14 +710,14 @@ usage(void)
printf(_(" -n, --limit=N number of records to display\n"));
printf(_(" -p, --path=PATH directory in which to find log segment files or a\n"
" directory with a ./pg_wal that contains such files\n"
" (default: current directory, ./pg_wal, PGDATA/pg_wal)\n"));
printf(_(" -r, --rmgr=RMGR only show records generated by resource manager RMGR\n"
" (default: current directory, ./pg_wal, $PGDATA/pg_wal)\n"));
printf(_(" -r, --rmgr=RMGR only show records generated by resource manager RMGR;\n"
" use --rmgr=list to list valid resource manager names\n"));
printf(_(" -s, --start=RECPTR start reading at WAL location RECPTR\n"));
printf(_(" -t, --timeline=TLI timeline from which to read log records\n"
" (default: 1 or the value used in STARTSEG)\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -x, --xid=XID only show records with TransactionId XID\n"));
printf(_(" -x, --xid=XID only show records with transaction ID XID\n"));
printf(_(" -z, --stats[=record] show statistics instead of records\n"
" (optionally, show per-record statistics)\n"));
printf(_(" -?, --help show this help, then exit\n"));
@ -870,7 +870,7 @@ main(int argc, char **argv)
case 'x':
if (sscanf(optarg, "%u", &config.filter_by_xid) != 1)
{
fprintf(stderr, _("%s: could not parse \"%s\" as a valid xid\n"),
fprintf(stderr, _("%s: could not parse \"%s\" as a transaction ID\n"),
progname, optarg);
goto bad_argument;
}
@ -910,7 +910,7 @@ main(int argc, char **argv)
if (!verify_directory(private.inpath))
{
fprintf(stderr,
_("%s: path \"%s\" cannot be opened: %s\n"),
_("%s: path \"%s\" could not be opened: %s\n"),
progname, private.inpath, strerror(errno));
goto bad_argument;
}
@ -931,7 +931,7 @@ main(int argc, char **argv)
private.inpath = directory;
if (!verify_directory(private.inpath))
fatal_error("cannot open directory \"%s\": %s",
fatal_error("could not open directory \"%s\": %s",
private.inpath, strerror(errno));
}
@ -1029,7 +1029,9 @@ main(int argc, char **argv)
* a segment (e.g. we were used in file mode).
*/
if (first_record != private.startptr && (private.startptr % XLogSegSize) != 0)
printf(_("first record is after %X/%X, at %X/%X, skipping over %u bytes\n"),
printf(ngettext("first record is after %X/%X, at %X/%X, skipping over %u byte\n",
"first record is after %X/%X, at %X/%X, skipping over %u bytes\n",
(first_record - private.startptr)),
(uint32) (private.startptr >> 32), (uint32) private.startptr,
(uint32) (first_record >> 32), (uint32) first_record,
(uint32) (first_record - private.startptr));