From: Peter Eisentraut Date: Mon, 7 Nov 2016 17:00:00 +0000 (-0500) Subject: pg_rewing pg_upgrade: Fix translation markers X-Git-Tag: REL9_6_2~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=674f7015caa044bed73a5883f1d4b088ac0adf22;p=postgresql pg_rewing pg_upgrade: Fix translation markers In pg_log_v(), we need to translate the fmt before processing, not the formatted message afterwards. --- diff --git a/src/bin/pg_rewind/logging.c b/src/bin/pg_rewind/logging.c index a232abb39f..0ac1b7add4 100644 --- a/src/bin/pg_rewind/logging.c +++ b/src/bin/pg_rewind/logging.c @@ -34,26 +34,26 @@ pg_log_v(eLogType type, const char *fmt, va_list ap) { char message[QUERY_ALLOC]; - vsnprintf(message, sizeof(message), fmt, ap); + vsnprintf(message, sizeof(message), _(fmt), ap); switch (type) { case PG_DEBUG: if (debug) - printf("%s", _(message)); + printf("%s", message); break; case PG_PROGRESS: if (showprogress) - printf("%s", _(message)); + printf("%s", message); break; case PG_WARNING: - printf("%s", _(message)); + printf("%s", message); break; case PG_FATAL: - printf("\n%s", _(message)); + printf("\n%s", message); printf("%s", _("Failure, exiting\n")); exit(1); break; diff --git a/src/bin/pg_upgrade/util.c b/src/bin/pg_upgrade/util.c index aadc1cdd9d..52e891219b 100644 --- a/src/bin/pg_upgrade/util.c +++ b/src/bin/pg_upgrade/util.c @@ -89,7 +89,7 @@ pg_log_v(eLogType type, const char *fmt, va_list ap) { char message[QUERY_ALLOC]; - vsnprintf(message, sizeof(message), fmt, ap); + vsnprintf(message, sizeof(message), _(fmt), ap); /* PG_VERBOSE and PG_STATUS are only output in verbose mode */ /* fopen() on log_opts.internal might have failed, so check it */ @@ -108,7 +108,7 @@ pg_log_v(eLogType type, const char *fmt, va_list ap) { case PG_VERBOSE: if (log_opts.verbose) - printf("%s", _(message)); + printf("%s", message); break; case PG_STATUS: @@ -123,16 +123,16 @@ pg_log_v(eLogType type, const char *fmt, va_list ap) strlen(message) <= MESSAGE_WIDTH - 2 ? message : message + strlen(message) - MESSAGE_WIDTH + 3 + 2); else - printf(" %s\n", _(message)); + printf(" %s\n", message); break; case PG_REPORT: case PG_WARNING: - printf("%s", _(message)); + printf("%s", message); break; case PG_FATAL: - printf("\n%s", _(message)); + printf("\n%s", message); printf("Failure, exiting\n"); exit(1); break;