Skip to content

Commit fc0fefb

Browse files
committed
pg_amcheck: Add basic NLS support
1 parent 44c8a3d commit fc0fefb

File tree

2 files changed

+64
-57
lines changed

2 files changed

+64
-57
lines changed

src/bin/pg_amcheck/nls.mk

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# src/bin/pg_amcheck/nls.mk
2+
CATALOG_NAME = pg_amcheck
3+
AVAIL_LANGUAGES =
4+
GETTEXT_FILES = $(FRONTEND_COMMON_GETTEXT_FILES) \
5+
pg_amcheck.c
6+
GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS)
7+
GETTEXT_FLAGS = $(FRONTEND_COMMON_GETTEXT_FLAGS)

src/bin/pg_amcheck/pg_amcheck.c

+57-57
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ main(int argc, char *argv[])
320320
if (opts.jobs < 1)
321321
{
322322
fprintf(stderr,
323-
"number of parallel jobs must be at least 1\n");
323+
_("number of parallel jobs must be at least 1\n"));
324324
exit(1);
325325
}
326326
break;
@@ -393,7 +393,7 @@ main(int argc, char *argv[])
393393
opts.skip = "all frozen";
394394
else
395395
{
396-
fprintf(stderr, "invalid skip option\n");
396+
fprintf(stderr, _("invalid skip option\n"));
397397
exit(1);
398398
}
399399
break;
@@ -402,13 +402,13 @@ main(int argc, char *argv[])
402402
if (*endptr != '\0')
403403
{
404404
fprintf(stderr,
405-
"invalid start block\n");
405+
_("invalid start block\n"));
406406
exit(1);
407407
}
408408
if (opts.startblock > MaxBlockNumber || opts.startblock < 0)
409409
{
410410
fprintf(stderr,
411-
"start block out of bounds\n");
411+
_("start block out of bounds\n"));
412412
exit(1);
413413
}
414414
break;
@@ -417,13 +417,13 @@ main(int argc, char *argv[])
417417
if (*endptr != '\0')
418418
{
419419
fprintf(stderr,
420-
"invalid end block\n");
420+
_("invalid end block\n"));
421421
exit(1);
422422
}
423423
if (opts.endblock > MaxBlockNumber || opts.endblock < 0)
424424
{
425425
fprintf(stderr,
426-
"end block out of bounds\n");
426+
_("end block out of bounds\n"));
427427
exit(1);
428428
}
429429
break;
@@ -442,7 +442,7 @@ main(int argc, char *argv[])
442442
break;
443443
default:
444444
fprintf(stderr,
445-
"Try \"%s --help\" for more information.\n",
445+
_("Try \"%s --help\" for more information.\n"),
446446
progname);
447447
exit(1);
448448
}
@@ -451,7 +451,7 @@ main(int argc, char *argv[])
451451
if (opts.endblock >= 0 && opts.endblock < opts.startblock)
452452
{
453453
fprintf(stderr,
454-
"end block precedes start block\n");
454+
_("end block precedes start block\n"));
455455
exit(1);
456456
}
457457

@@ -1116,52 +1116,52 @@ verify_btree_slot_handler(PGresult *res, PGconn *conn, void *context)
11161116
static void
11171117
help(const char *progname)
11181118
{
1119-
printf("%s uses amcheck module to check objects in a PostgreSQL database for corruption.\n\n", progname);
1120-
printf("Usage:\n");
1121-
printf(" %s [OPTION]... [DBNAME]\n", progname);
1122-
printf("\nTarget Options:\n");
1123-
printf(" -a, --all check all databases\n");
1124-
printf(" -d, --database=PATTERN check matching database(s)\n");
1125-
printf(" -D, --exclude-database=PATTERN do NOT check matching database(s)\n");
1126-
printf(" -i, --index=PATTERN check matching index(es)\n");
1127-
printf(" -I, --exclude-index=PATTERN do NOT check matching index(es)\n");
1128-
printf(" -r, --relation=PATTERN check matching relation(s)\n");
1129-
printf(" -R, --exclude-relation=PATTERN do NOT check matching relation(s)\n");
1130-
printf(" -s, --schema=PATTERN check matching schema(s)\n");
1131-
printf(" -S, --exclude-schema=PATTERN do NOT check matching schema(s)\n");
1132-
printf(" -t, --table=PATTERN check matching table(s)\n");
1133-
printf(" -T, --exclude-table=PATTERN do NOT check matching table(s)\n");
1134-
printf(" --no-dependent-indexes do NOT expand list of relations to include indexes\n");
1135-
printf(" --no-dependent-toast do NOT expand list of relations to include toast\n");
1136-
printf(" --no-strict-names do NOT require patterns to match objects\n");
1137-
printf("\nTable Checking Options:\n");
1138-
printf(" --exclude-toast-pointers do NOT follow relation toast pointers\n");
1139-
printf(" --on-error-stop stop checking at end of first corrupt page\n");
1140-
printf(" --skip=OPTION do NOT check \"all-frozen\" or \"all-visible\" blocks\n");
1141-
printf(" --startblock=BLOCK begin checking table(s) at the given block number\n");
1142-
printf(" --endblock=BLOCK check table(s) only up to the given block number\n");
1143-
printf("\nBtree Index Checking Options:\n");
1144-
printf(" --heapallindexed check all heap tuples are found within indexes\n");
1145-
printf(" --parent-check check index parent/child relationships\n");
1146-
printf(" --rootdescend search from root page to refind tuples\n");
1147-
printf("\nConnection options:\n");
1148-
printf(" -h, --host=HOSTNAME database server host or socket directory\n");
1149-
printf(" -p, --port=PORT database server port\n");
1150-
printf(" -U, --username=USERNAME user name to connect as\n");
1151-
printf(" -w, --no-password never prompt for password\n");
1152-
printf(" -W, --password force password prompt\n");
1153-
printf(" --maintenance-db=DBNAME alternate maintenance database\n");
1154-
printf("\nOther Options:\n");
1155-
printf(" -e, --echo show the commands being sent to the server\n");
1156-
printf(" -j, --jobs=NUM use this many concurrent connections to the server\n");
1157-
printf(" -q, --quiet don't write any messages\n");
1158-
printf(" -v, --verbose write a lot of output\n");
1159-
printf(" -V, --version output version information, then exit\n");
1160-
printf(" -P, --progress show progress information\n");
1161-
printf(" -?, --help show this help, then exit\n");
1162-
1163-
printf("\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT);
1164-
printf("%s home page: <%s>\n", PACKAGE_NAME, PACKAGE_URL);
1119+
printf(_("%s uses amcheck module to check objects in a PostgreSQL database for corruption.\n\n"), progname);
1120+
printf(_("Usage:\n"));
1121+
printf(_(" %s [OPTION]... [DBNAME]\n"), progname);
1122+
printf(_("\nTarget Options:\n"));
1123+
printf(_(" -a, --all check all databases\n"));
1124+
printf(_(" -d, --database=PATTERN check matching database(s)\n"));
1125+
printf(_(" -D, --exclude-database=PATTERN do NOT check matching database(s)\n"));
1126+
printf(_(" -i, --index=PATTERN check matching index(es)\n"));
1127+
printf(_(" -I, --exclude-index=PATTERN do NOT check matching index(es)\n"));
1128+
printf(_(" -r, --relation=PATTERN check matching relation(s)\n"));
1129+
printf(_(" -R, --exclude-relation=PATTERN do NOT check matching relation(s)\n"));
1130+
printf(_(" -s, --schema=PATTERN check matching schema(s)\n"));
1131+
printf(_(" -S, --exclude-schema=PATTERN do NOT check matching schema(s)\n"));
1132+
printf(_(" -t, --table=PATTERN check matching table(s)\n"));
1133+
printf(_(" -T, --exclude-table=PATTERN do NOT check matching table(s)\n"));
1134+
printf(_(" --no-dependent-indexes do NOT expand list of relations to include indexes\n"));
1135+
printf(_(" --no-dependent-toast do NOT expand list of relations to include toast\n"));
1136+
printf(_(" --no-strict-names do NOT require patterns to match objects\n"));
1137+
printf(_("\nTable Checking Options:\n"));
1138+
printf(_(" --exclude-toast-pointers do NOT follow relation toast pointers\n"));
1139+
printf(_(" --on-error-stop stop checking at end of first corrupt page\n"));
1140+
printf(_(" --skip=OPTION do NOT check \"all-frozen\" or \"all-visible\" blocks\n"));
1141+
printf(_(" --startblock=BLOCK begin checking table(s) at the given block number\n"));
1142+
printf(_(" --endblock=BLOCK check table(s) only up to the given block number\n"));
1143+
printf(_("\nBtree Index Checking Options:\n"));
1144+
printf(_(" --heapallindexed check all heap tuples are found within indexes\n"));
1145+
printf(_(" --parent-check check index parent/child relationships\n"));
1146+
printf(_(" --rootdescend search from root page to refind tuples\n"));
1147+
printf(_("\nConnection options:\n"));
1148+
printf(_(" -h, --host=HOSTNAME database server host or socket directory\n"));
1149+
printf(_(" -p, --port=PORT database server port\n"));
1150+
printf(_(" -U, --username=USERNAME user name to connect as\n"));
1151+
printf(_(" -w, --no-password never prompt for password\n"));
1152+
printf(_(" -W, --password force password prompt\n"));
1153+
printf(_(" --maintenance-db=DBNAME alternate maintenance database\n"));
1154+
printf(_("\nOther Options:\n"));
1155+
printf(_(" -e, --echo show the commands being sent to the server\n"));
1156+
printf(_(" -j, --jobs=NUM use this many concurrent connections to the server\n"));
1157+
printf(_(" -q, --quiet don't write any messages\n"));
1158+
printf(_(" -v, --verbose write a lot of output\n"));
1159+
printf(_(" -V, --version output version information, then exit\n"));
1160+
printf(_(" -P, --progress show progress information\n"));
1161+
printf(_(" -?, --help show this help, then exit\n"));
1162+
1163+
printf(_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
1164+
printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
11651165
}
11661166

11671167
/*
@@ -1219,7 +1219,7 @@ progress_report(uint64 relations_total, uint64 relations_checked,
12191219
* last call)
12201220
*/
12211221
fprintf(stderr,
1222-
"%*s/%s relations (%d%%) %*s/%s pages (%d%%) %*s",
1222+
_("%*s/%s relations (%d%%) %*s/%s pages (%d%%) %*s"),
12231223
(int) strlen(total_rel),
12241224
checked_rel, total_rel, percent_rel,
12251225
(int) strlen(total_pages),
@@ -1230,7 +1230,7 @@ progress_report(uint64 relations_total, uint64 relations_checked,
12301230
bool truncate = (strlen(datname) > VERBOSE_DATNAME_LENGTH);
12311231

12321232
fprintf(stderr,
1233-
"%*s/%s relations (%d%%) %*s/%s pages (%d%%), (%s%-*.*s)",
1233+
_("%*s/%s relations (%d%%) %*s/%s pages (%d%%), (%s%-*.*s)"),
12341234
(int) strlen(total_rel),
12351235
checked_rel, total_rel, percent_rel,
12361236
(int) strlen(total_pages),
@@ -1245,7 +1245,7 @@ progress_report(uint64 relations_total, uint64 relations_checked,
12451245
}
12461246
else
12471247
fprintf(stderr,
1248-
"%*s/%s relations (%d%%) %*s/%s pages (%d%%)",
1248+
_("%*s/%s relations (%d%%) %*s/%s pages (%d%%)"),
12491249
(int) strlen(total_rel),
12501250
checked_rel, total_rel, percent_rel,
12511251
(int) strlen(total_pages),

0 commit comments

Comments
 (0)