]> granicus.if.org Git - postgresql/commitdiff
pg_rewing pg_upgrade: Fix translation markers
authorPeter Eisentraut <peter_e@gmx.net>
Mon, 7 Nov 2016 17:00:00 +0000 (12:00 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Mon, 7 Nov 2016 14:53:55 +0000 (09:53 -0500)
In pg_log_v(), we need to translate the fmt before processing, not the
formatted message afterwards.

src/bin/pg_rewind/logging.c
src/bin/pg_upgrade/util.c

index a232abb39f0ec286487b79611ecd37824f7bf7bd..0ac1b7add466929d6adcac2d9b99dbc08e674902 100644 (file)
@@ -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;
index aadc1cdd9df9a2990b219448f9d8a459ee9da8e8..52e891219b6273b18e6ece1100552be76efeeee3 100644 (file)
@@ -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;