pg_verify_checksums: Message style improvements and NLS support

The source code was already set up for NLS support, so just a nls.mk
file needed to be added.  Also, fix the old problem of putting the int64
format specifier right into the string, which breaks NLS.
This commit is contained in:
Peter Eisentraut 2018-08-28 11:49:11 +02:00
parent 2657d4ea66
commit da793baca2
2 changed files with 12 additions and 8 deletions

View File

@ -0,0 +1,4 @@
# src/bin/pg_verify_checksums/nls.mk
CATALOG_NAME = pg_verify_checksums
AVAIL_LANGUAGES =
GETTEXT_FILES = pg_verify_checksums.c

View File

@ -177,7 +177,7 @@ scan_directory(char *basedir, char *subdir)
segmentno = atoi(segmentpath);
if (segmentno == 0)
{
fprintf(stderr, _("%s: invalid segment number %d in filename \"%s\"\n"),
fprintf(stderr, _("%s: invalid segment number %d in file name \"%s\"\n"),
progname, segmentno, fn);
exit(1);
}
@ -247,7 +247,7 @@ main(int argc, char *argv[])
case 'r':
if (atoi(optarg) <= 0)
{
fprintf(stderr, _("%s: invalid relfilenode: %s\n"), progname, optarg);
fprintf(stderr, _("%s: invalid relfilenode specification, must be numeric: %s\n"), progname, optarg);
exit(1);
}
only_relfilenode = pstrdup(optarg);
@ -288,20 +288,20 @@ main(int argc, char *argv[])
ControlFile = get_controlfile(DataDir, progname, &crc_ok);
if (!crc_ok)
{
fprintf(stderr, _("%s: pg_control CRC value is incorrect.\n"), progname);
fprintf(stderr, _("%s: pg_control CRC value is incorrect\n"), progname);
exit(1);
}
if (ControlFile->state != DB_SHUTDOWNED &&
ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY)
{
fprintf(stderr, _("%s: cluster must be shut down to verify checksums.\n"), progname);
fprintf(stderr, _("%s: cluster must be shut down to verify checksums\n"), progname);
exit(1);
}
if (ControlFile->data_checksum_version == 0)
{
fprintf(stderr, _("%s: data checksums are not enabled in cluster.\n"), progname);
fprintf(stderr, _("%s: data checksums are not enabled in cluster\n"), progname);
exit(1);
}
@ -312,9 +312,9 @@ main(int argc, char *argv[])
printf(_("Checksum scan completed\n"));
printf(_("Data checksum version: %d\n"), ControlFile->data_checksum_version);
printf(_("Files scanned: %" INT64_MODIFIER "d\n"), files);
printf(_("Blocks scanned: %" INT64_MODIFIER "d\n"), blocks);
printf(_("Bad checksums: %" INT64_MODIFIER "d\n"), badblocks);
printf(_("Files scanned: %s\n"), psprintf(INT64_FORMAT, files));
printf(_("Blocks scanned: %s\n"), psprintf(INT64_FORMAT, blocks));
printf(_("Bad checksums: %s\n"), psprintf(INT64_FORMAT, badblocks));
if (badblocks > 0)
return 1;