Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e86ac70

Browse files
committed
Message translatability fixes
1 parent d22e9d5 commit e86ac70

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

src/bin/pg_test_fsync/pg_test_fsync.c

+17-13
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
#define XLOG_BLCKSZ_K (XLOG_BLCKSZ / 1024)
2626

2727
#define LABEL_FORMAT " %-30s"
28-
#define NA_FORMAT "%20s"
29-
#define OPS_FORMAT "%13.3f ops/sec %6.0f usecs/op"
28+
#define NA_FORMAT "%21s\n"
29+
/* translator: maintain alignment with NA_FORMAT */
30+
#define OPS_FORMAT gettext_noop("%13.3f ops/sec %6.0f usecs/op\n")
3031
#define USECS_SEC 1000000
3132

3233
/* These are macros to avoid timing the function call overhead. */
@@ -45,7 +46,7 @@ do { \
4546
if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \
4647
INVALID_HANDLE_VALUE) \
4748
{ \
48-
fprintf(stderr, _("Cannot create thread for alarm\n")); \
49+
fprintf(stderr, _("Could not create thread for alarm\n")); \
4950
exit(1); \
5051
} \
5152
gettimeofday(&start_t, NULL); \
@@ -191,7 +192,10 @@ handle_args(int argc, char *argv[])
191192
exit(1);
192193
}
193194

194-
printf(_("%d seconds per test\n"), secs_per_test);
195+
printf(ngettext("%d second per test\n",
196+
"%d seconds per test\n",
197+
secs_per_test),
198+
secs_per_test);
195199
#if PG_O_DIRECT != 0
196200
printf(_("O_DIRECT supported on this platform for open_datasync and open_sync.\n"));
197201
#else
@@ -255,7 +259,7 @@ test_sync(int writes_per_op)
255259
#ifdef OPEN_DATASYNC_FLAG
256260
if ((tmpfile = open(filename, O_RDWR | O_DSYNC | PG_O_DIRECT, 0)) == -1)
257261
{
258-
printf(NA_FORMAT, _("n/a*\n"));
262+
printf(NA_FORMAT, _("n/a*"));
259263
fs_warning = true;
260264
}
261265
else
@@ -273,7 +277,7 @@ test_sync(int writes_per_op)
273277
close(tmpfile);
274278
}
275279
#else
276-
printf(NA_FORMAT, _("n/a\n"));
280+
printf(NA_FORMAT, _("n/a"));
277281
#endif
278282

279283
/*
@@ -298,7 +302,7 @@ test_sync(int writes_per_op)
298302
STOP_TIMER;
299303
close(tmpfile);
300304
#else
301-
printf(NA_FORMAT, _("n/a\n"));
305+
printf(NA_FORMAT, _("n/a"));
302306
#endif
303307

304308
/*
@@ -346,7 +350,7 @@ test_sync(int writes_per_op)
346350
STOP_TIMER;
347351
close(tmpfile);
348352
#else
349-
printf(NA_FORMAT, _("n/a\n"));
353+
printf(NA_FORMAT, _("n/a"));
350354
#endif
351355

352356
/*
@@ -358,7 +362,7 @@ test_sync(int writes_per_op)
358362
#ifdef OPEN_SYNC_FLAG
359363
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1)
360364
{
361-
printf(NA_FORMAT, _("n/a*\n"));
365+
printf(NA_FORMAT, _("n/a*"));
362366
fs_warning = true;
363367
}
364368
else
@@ -383,7 +387,7 @@ test_sync(int writes_per_op)
383387
close(tmpfile);
384388
}
385389
#else
386-
printf(NA_FORMAT, _("n/a\n"));
390+
printf(NA_FORMAT, _("n/a"));
387391
#endif
388392

389393
if (fs_warning)
@@ -424,7 +428,7 @@ test_open_sync(const char *msg, int writes_size)
424428

425429
#ifdef OPEN_SYNC_FLAG
426430
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1)
427-
printf(NA_FORMAT, _("n/a*\n"));
431+
printf(NA_FORMAT, _("n/a*"));
428432
else
429433
{
430434
START_TIMER;
@@ -441,7 +445,7 @@ test_open_sync(const char *msg, int writes_size)
441445
close(tmpfile);
442446
}
443447
#else
444-
printf(NA_FORMAT, _("n/a\n"));
448+
printf(NA_FORMAT, _("n/a"));
445449
#endif
446450
}
447451

@@ -577,7 +581,7 @@ print_elapse(struct timeval start_t, struct timeval stop_t, int ops)
577581
double per_second = ops / total_time;
578582
double avg_op_time_us = (total_time / ops) * USECS_SEC;
579583

580-
printf(OPS_FORMAT "\n", per_second, avg_op_time_us);
584+
printf(_(OPS_FORMAT), per_second, avg_op_time_us);
581585
}
582586

583587
#ifndef WIN32

src/bin/pg_waldump/pg_waldump.c

+11-9
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ XLogDumpXLogRead(const char *directory, TimeLineID timeline_id,
300300

301301
XLogFileName(fname, timeline_id, sendSegNo);
302302

303-
fatal_error("could not seek in log segment %s to offset %u: %s",
303+
fatal_error("could not seek in log file %s to offset %u: %s",
304304
fname, startoff, strerror(err));
305305
}
306306
sendOff = startoff;
@@ -320,7 +320,7 @@ XLogDumpXLogRead(const char *directory, TimeLineID timeline_id,
320320

321321
XLogFileName(fname, timeline_id, sendSegNo);
322322

323-
fatal_error("could not read from log segment %s, offset %d, length %d: %s",
323+
fatal_error("could not read from log file %s, offset %u, length %d: %s",
324324
fname, sendOff, segbytes, strerror(err));
325325
}
326326

@@ -710,14 +710,14 @@ usage(void)
710710
printf(_(" -n, --limit=N number of records to display\n"));
711711
printf(_(" -p, --path=PATH directory in which to find log segment files or a\n"
712712
" directory with a ./pg_wal that contains such files\n"
713-
" (default: current directory, ./pg_wal, PGDATA/pg_wal)\n"));
714-
printf(_(" -r, --rmgr=RMGR only show records generated by resource manager RMGR\n"
713+
" (default: current directory, ./pg_wal, $PGDATA/pg_wal)\n"));
714+
printf(_(" -r, --rmgr=RMGR only show records generated by resource manager RMGR;\n"
715715
" use --rmgr=list to list valid resource manager names\n"));
716716
printf(_(" -s, --start=RECPTR start reading at WAL location RECPTR\n"));
717717
printf(_(" -t, --timeline=TLI timeline from which to read log records\n"
718718
" (default: 1 or the value used in STARTSEG)\n"));
719719
printf(_(" -V, --version output version information, then exit\n"));
720-
printf(_(" -x, --xid=XID only show records with TransactionId XID\n"));
720+
printf(_(" -x, --xid=XID only show records with transaction ID XID\n"));
721721
printf(_(" -z, --stats[=record] show statistics instead of records\n"
722722
" (optionally, show per-record statistics)\n"));
723723
printf(_(" -?, --help show this help, then exit\n"));
@@ -870,7 +870,7 @@ main(int argc, char **argv)
870870
case 'x':
871871
if (sscanf(optarg, "%u", &config.filter_by_xid) != 1)
872872
{
873-
fprintf(stderr, _("%s: could not parse \"%s\" as a valid xid\n"),
873+
fprintf(stderr, _("%s: could not parse \"%s\" as a transaction ID\n"),
874874
progname, optarg);
875875
goto bad_argument;
876876
}
@@ -910,7 +910,7 @@ main(int argc, char **argv)
910910
if (!verify_directory(private.inpath))
911911
{
912912
fprintf(stderr,
913-
_("%s: path \"%s\" cannot be opened: %s\n"),
913+
_("%s: path \"%s\" could not be opened: %s\n"),
914914
progname, private.inpath, strerror(errno));
915915
goto bad_argument;
916916
}
@@ -931,7 +931,7 @@ main(int argc, char **argv)
931931
private.inpath = directory;
932932

933933
if (!verify_directory(private.inpath))
934-
fatal_error("cannot open directory \"%s\": %s",
934+
fatal_error("could not open directory \"%s\": %s",
935935
private.inpath, strerror(errno));
936936
}
937937

@@ -1029,7 +1029,9 @@ main(int argc, char **argv)
10291029
* a segment (e.g. we were used in file mode).
10301030
*/
10311031
if (first_record != private.startptr && (private.startptr % XLogSegSize) != 0)
1032-
printf(_("first record is after %X/%X, at %X/%X, skipping over %u bytes\n"),
1032+
printf(ngettext("first record is after %X/%X, at %X/%X, skipping over %u byte\n",
1033+
"first record is after %X/%X, at %X/%X, skipping over %u bytes\n",
1034+
(first_record - private.startptr)),
10331035
(uint32) (private.startptr >> 32), (uint32) private.startptr,
10341036
(uint32) (first_record >> 32), (uint32) first_record,
10351037
(uint32) (first_record - private.startptr));

0 commit comments

Comments
 (0)