Hello. I found that backend's .po file has lines for GUC descriptions but we won't see them anywhere.
The cause is GetConfigOptionByNum is fogetting to retrieve translations for texts that have been marked with gettext_noop. Regarding GUCs, group names, short desc and long desc have translations so the attached first patch (fix_GUC_nls.patch) let the translations appear. Besides GUCs, I found another misuse of gettext_noop in pg_GSS_recvauth. (2nd fix_GSSerr_nls.patch) view_query_is_auto_updatable() and most of its caller are making the same mistake in a similar way. All caller sites require only translated message but bringing translated message around doesn't seem good so the attached third patch adds _() to all required places. (3rd fix_view_updt_nls.patch, 5th fix_vacuumdb_nls.patch) psql is making a bit different mistake. \gdesc seems intending the output columns names in NLS string but they actually aren't. DescribeQuery is using PrintQueryResults but it is intended to be used only for SendQuery. Replacing it with printQuery let \gdesc print NLS string but I'm not sure it is the right thing to fix this. (4th, fix psql_nls.patch) plperl/plpgsql/tcl have another kind of problem in NLS. It installs some GUC parameters and their descriptions actually have a translation but in *its own* po file. So GetConfigOptionByNum cannot get them. I don't have an idea to fix this for now. regards. -- Kyotaro Horiguchi NTT Open Source Software Center
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index b05fb209bb..7b023c0064 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -8419,13 +8419,13 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow) values[2] = NULL; /* group */ - values[3] = config_group_names[conf->group]; + values[3] = gettext(config_group_names[conf->group]); /* short_desc */ - values[4] = conf->short_desc; + values[4] = gettext(conf->short_desc); /* extra_desc */ - values[5] = conf->long_desc; + values[5] = gettext(conf->long_desc); /* context */ values[6] = GucContext_Names[conf->context];
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index cecd104b4a..43a93e493a 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -1227,7 +1227,7 @@ pg_GSS_recvauth(Port *port) { gss_delete_sec_context(&lmin_s, &port->gss->ctx, GSS_C_NO_BUFFER); pg_GSS_error(ERROR, - gettext_noop("accepting GSS security context failed"), + gettext("accepting GSS security context failed"), maj_stat, min_stat); } @@ -1253,7 +1253,7 @@ pg_GSS_recvauth(Port *port) maj_stat = gss_display_name(&min_stat, port->gss->name, &gbuf, NULL); if (maj_stat != GSS_S_COMPLETE) pg_GSS_error(ERROR, - gettext_noop("retrieving GSS user name failed"), + gettext("retrieving GSS user name failed"), maj_stat, min_stat); /*
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index eb2d33dd86..2ac7eae84b 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -10807,7 +10807,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("WITH CHECK OPTION is supported only on automatically updatable views"), - errhint("%s", view_updatable_error))); + errhint("%s", _(view_updatable_error)))); } } diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index 7d4511c585..ffb71c0ea7 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -502,7 +502,7 @@ DefineView(ViewStmt *stmt, const char *queryString, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("WITH CHECK OPTION is supported only on automatically updatable views"), - errhint("%s", view_updatable_error))); + errhint("%s", _(view_updatable_error)))); } /*
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index b56995925b..1894e812e6 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1640,7 +1640,14 @@ DescribeQuery(const char *query, double *elapsed_msec) } if (OK && results) - OK = PrintQueryResults(results); + { + printQueryOpt myopt = pset.popt; + + myopt.nullPrint = NULL; + myopt.title = NULL; + myopt.translate_header = true; + printQuery(results, &myopt, pset.queryFout, false, pset.logfile); + } termPQExpBuffer(&buf); }
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 60f8b1c394..9408b8f869 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -371,7 +371,7 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts, { if (stage != ANALYZE_NO_STAGE) printf(_("%s: processing database \"%s\": %s\n"), - progname, PQdb(conn), stage_messages[stage]); + progname, PQdb(conn), _(stage_messages[stage])); else printf(_("%s: vacuuming database \"%s\"\n"), progname, PQdb(conn));