Gettext plural support
authorPeter Eisentraut
Thu, 26 Mar 2009 22:26:08 +0000 (22:26 +0000)
committerPeter Eisentraut
Thu, 26 Mar 2009 22:26:08 +0000 (22:26 +0000)
In the backend, I changed only a handful of exemplary or important-looking
instances to make use of the plural support; there is probably more work
there.  For the rest of the source, this should cover all relevant cases.

15 files changed:
src/backend/catalog/dependency.c
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_shdepend.c
src/backend/executor/execQual.c
src/backend/parser/parse_func.c
src/backend/postmaster/bgwriter.c
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_dump.c
src/bin/psql/describe.c
src/bin/psql/print.c
src/include/c.h
src/interfaces/ecpg/preproc/variable.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpython/plpython.c

index 70c43cdec02dbc32733ec7e1eb8ee33a4b26848d..957cac49f3895d8ba26813155f5f9ecef493cfba 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.86 2009/01/22 20:16:00 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.87 2009/03/26 22:26:06 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -885,8 +885,11 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
    }
 
    if (numNotReportedClient > 0)
-       appendStringInfo(&clientdetail, _("\nand %d other objects "
-                                         "(see server log for list)"),
+       appendStringInfo(&clientdetail, ngettext("\nand %d other object "
+                                                "(see server log for list)",
+                                                "\nand %d other objects "
+                                                "(see server log for list)",
+                                                numNotReportedClient),
                         numNotReportedClient);
 
    if (!ok)
@@ -911,7 +914,9 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
    {
        ereport(msglevel,
                /* translator: %d always has a value larger than 1 */
-               (errmsg("drop cascades to %d other objects",
+               (errmsg(ngettext("drop cascades to %d other object",
+                                "drop cascades to %d other objects",
+                                numReportedClient + numNotReportedClient),
                        numReportedClient + numNotReportedClient),
                 errdetail("%s", clientdetail.data),
                 errdetail_log("%s", logdetail.data)));
index f9b2716b9f73e1682a32fec2c73a3fb1eb59d88f..ad9539234f303b6360ab602457ea406eaf7f54db 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.161 2009/01/22 20:16:01 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.162 2009/03/26 22:26:06 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -112,7 +112,9 @@ ProcedureCreate(const char *procedureName,
    if (parameterCount < 0 || parameterCount > FUNC_MAX_ARGS)
        ereport(ERROR,
                (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
-                errmsg("functions cannot have more than %d arguments",
+                errmsg(ngettext("functions cannot have more than %d argument",
+                                "functions cannot have more than %d arguments",
+                                FUNC_MAX_ARGS),
                        FUNC_MAX_ARGS)));
    /* note: the above is correct, we do NOT count output arguments */
 
index ee5329b1d705270c936d7f71a8250af61ca8f7f4..a4de276b8d608abf38eb05e6fd0d132735b10f14 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.31 2009/01/22 20:16:01 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.32 2009/03/26 22:26:06 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -655,12 +655,18 @@ checkSharedDependencies(Oid classId, Oid objectId,
    }
 
    if (numNotReportedDeps > 0)
-       appendStringInfo(&descs, _("\nand %d other objects "
-                                  "(see server log for list)"),
+       appendStringInfo(&descs, ngettext("\nand %d other object "
+                                         "(see server log for list)",
+                                         "\nand %d other objects "
+                                         "(see server log for list)",
+                                         numNotReportedDeps),
                         numNotReportedDeps);
    if (numNotReportedDbs > 0)
-       appendStringInfo(&descs, _("\nand objects in %d other databases "
-                                  "(see server log for list)"),
+       appendStringInfo(&descs, ngettext("\nand objects in %d other database "
+                                         "(see server log for list)",
+                                         "\nand objects in %d other databases "
+                                         "(see server log for list)",
+                                         numNotReportedDbs),
                         numNotReportedDbs);
 
    *detail_msg = descs.data;
@@ -1043,7 +1049,7 @@ storeObjectDescription(StringInfo descs, objectType type,
 
        case REMOTE_OBJECT:
            /* translator: %s will always be "database %s" */
-           appendStringInfo(descs, _("%d objects in %s"), count, objdesc);
+           appendStringInfo(descs, ngettext("%d object in %s", "%d objects in %s", count), count, objdesc);
            break;
 
        default:
index f74a5da6b281126d5a3dc9fa44af3b198b719fc2..a1e2589162cb55f3302347b4f79124711b1e4380 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.241 2009/01/09 15:46:10 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.242 2009/03/26 22:26:06 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -616,7 +616,9 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
                ereport(ERROR,
                        (errcode(ERRCODE_DATATYPE_MISMATCH),
                         errmsg("table row type and query-specified row type do not match"),
-                        errdetail("Table row contains %d attributes, but query expects %d.",
+                        errdetail(ngettext("Table row contains %d attribute, but query expects %d.",
+                                   "Table row contains %d attributes, but query expects %d.",
+                                   slot_tupdesc->natts),
                                   slot_tupdesc->natts, var_tupdesc->natts)));
            else if (var_tupdesc->natts < slot_tupdesc->natts)
                needslow = true;
@@ -1041,7 +1043,9 @@ init_fcache(Oid foid, FuncExprState *fcache,
    if (list_length(fcache->args) > FUNC_MAX_ARGS)
        ereport(ERROR,
                (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
-                errmsg("cannot pass more than %d arguments to a function",
+                errmsg(ngettext("cannot pass more than %d argument to a function",
+                                "cannot pass more than %d arguments to a function",
+                                FUNC_MAX_ARGS),
                        FUNC_MAX_ARGS)));
 
    /* Set up the primary fmgr lookup information */
@@ -1310,7 +1314,9 @@ tupledesc_match(TupleDesc dst_tupdesc, TupleDesc src_tupdesc)
        ereport(ERROR,
                (errcode(ERRCODE_DATATYPE_MISMATCH),
                 errmsg("function return row and query-specified return row do not match"),
-                errdetail("Returned row contains %d attributes, but query expects %d.",
+                errdetail(ngettext("Returned row contains %d attribute, but query expects %d.",
+                           "Returned row contains %d attributes, but query expects %d.",
+                           src_tupdesc->natts),
                           src_tupdesc->natts, dst_tupdesc->natts)));
 
    for (i = 0; i < dst_tupdesc->natts; i++)
index 4ef129a67b82baa888c3c2db98ed5ed77e7b54fe..edee35edceea44bf10fdb8cd6e4a74dc6688c16f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.211 2009/01/01 17:23:45 momjian Exp $
+ *   $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.212 2009/03/26 22:26:06 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -89,7 +89,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
    if (list_length(fargs) > FUNC_MAX_ARGS)
        ereport(ERROR,
                (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
-                errmsg("cannot pass more than %d arguments to a function",
+                errmsg(ngettext("cannot pass more than %d argument to a function",
+                                "cannot pass more than %d arguments to a function",
+                                FUNC_MAX_ARGS),
                        FUNC_MAX_ARGS),
                 parser_errposition(pstate, location)));
 
@@ -259,7 +261,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
        if (nargsplusdefs >= FUNC_MAX_ARGS)
            ereport(ERROR,
                    (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
-                    errmsg("cannot pass more than %d arguments to a function",
+                    errmsg(ngettext("cannot pass more than %d argument to a function",
+                                    "cannot pass more than %d arguments to a function",
+                                    FUNC_MAX_ARGS),
                            FUNC_MAX_ARGS),
                     parser_errposition(pstate, location)));
 
@@ -538,7 +542,9 @@ func_select_candidate(int nargs,
    if (nargs > FUNC_MAX_ARGS)
        ereport(ERROR,
                (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
-                errmsg("cannot pass more than %d arguments to a function",
+                errmsg(ngettext("cannot pass more than %d argument to a function",
+                                "cannot pass more than %d arguments to a function",
+                                FUNC_MAX_ARGS),
                        FUNC_MAX_ARGS)));
 
    /*
@@ -1413,7 +1419,9 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
    if (argcount > FUNC_MAX_ARGS)
        ereport(ERROR,
                (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
-                errmsg("functions cannot have more than %d arguments",
+                errmsg(ngettext("functions cannot have more than %d argument",
+                                "functions cannot have more than %d arguments",
+                                FUNC_MAX_ARGS),
                        FUNC_MAX_ARGS)));
 
    args_item = list_head(argtypes);
@@ -1451,7 +1459,9 @@ LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError)
    if (argcount > FUNC_MAX_ARGS)
        ereport(ERROR,
                (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
-                errmsg("functions cannot have more than %d arguments",
+                errmsg(ngettext("functions cannot have more than %d argument",
+                                "functions cannot have more than %d arguments",
+                                FUNC_MAX_ARGS),
                        FUNC_MAX_ARGS)));
 
    i = 0;
index 4909fbe37a4bab07928065cb14c75fe86943c13c..ebeded0212fa1e6104382582c18d06c66717cbe9 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.56 2009/02/18 15:58:41 heikki Exp $
+ *   $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.57 2009/03/26 22:26:06 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -459,7 +459,9 @@ BackgroundWriterMain(void)
                (flags & CHECKPOINT_CAUSE_XLOG) &&
                elapsed_secs < CheckPointWarning)
                ereport(LOG,
-                       (errmsg("checkpoints are occurring too frequently (%d seconds apart)",
+                       (errmsg(ngettext("checkpoints are occurring too frequently (%d second apart)",
+                                        "checkpoints are occurring too frequently (%d seconds apart)",
+                                        elapsed_secs),
                                elapsed_secs),
                         errhint("Consider increasing the configuration parameter \"checkpoint_segments\".")));
 
index f0ff3e7aa062294a2762d472693caa6fcd4edc26..378ee2ded2b7e38ca15222bf68b7985ecb485365 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *     $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.168 2009/03/20 09:21:08 petere Exp $
+ *     $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.169 2009/03/26 22:26:07 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -884,7 +884,10 @@ EndRestoreBlobs(ArchiveHandle *AH)
            ahprintf(AH, "COMMIT;\n\n");
    }
 
-   ahlog(AH, 1, "restored %d large objects\n", AH->blobCount);
+   ahlog(AH, 1, ngettext("restored %d large object\n",
+                         "restored %d large objects\n",
+                         AH->blobCount),
+         AH->blobCount);
 }
 
 
@@ -1230,7 +1233,9 @@ dump_lo_buf(ArchiveHandle *AH)
        size_t      res;
 
        res = lo_write(AH->connection, AH->loFd, AH->lo_buf, AH->lo_buf_used);
-       ahlog(AH, 5, "wrote %lu bytes of large object data (result = %lu)\n",
+       ahlog(AH, 5, ngettext("wrote %lu byte of large object data (result = %lu)\n",
+                             "wrote %lu bytes of large object data (result = %lu)\n",
+                             AH->lo_buf_used),
              (unsigned long) AH->lo_buf_used, (unsigned long) res);
        if (res != AH->lo_buf_used)
            die_horribly(AH, modulename,
@@ -1781,7 +1786,9 @@ _discoverArchiveFormat(ArchiveHandle *AH)
        AH->lookaheadLen = 0;   /* Don't bother since we've reset the file */
 
 #if 0
-   write_msg(modulename, "read %lu bytes into lookahead buffer\n",
+   write_msg(modulename, ngettext("read %lu byte into lookahead buffer\n",
+                                  "read %lu bytes into lookahead buffer\n",
+                                  AH->lookaheadLen),
              (unsigned long) AH->lookaheadLen);
 #endif
 
index 0156bbf9f00e54d29da233db1fa82bac9ea2c39a..972b0b2fd6720217ef0add51b7ca43437383b724 100644 (file)
@@ -16,7 +16,7 @@
  *
  *
  * IDENTIFICATION
- *     $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.63 2009/02/02 20:07:37 adunstan Exp $
+ *     $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.64 2009/03/26 22:26:07 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -550,7 +550,9 @@ _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh)
    }
 
 #if 0
-   write_msg(modulename, "requested %d bytes, got %d from lookahead and %d from file\n",
+   write_msg(modulename, ngettext("requested %d byte, got %d from lookahead and %d from file\n",
+                                  "requested %d bytes, got %d from lookahead and %d from file\n",
+                                  reqLen),
              reqLen, used, res);
 #endif
 
@@ -1246,7 +1248,9 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
 
        if (len != 512)
            die_horribly(AH, modulename,
-                        "incomplete tar header found (%lu bytes)\n",
+                        ngettext("incomplete tar header found (%lu byte)\n",
+                                 "incomplete tar header found (%lu bytes)\n",
+                                 len),
                         (unsigned long) len);
 
        /* Calc checksum */
index 1ee647119ab9bcc3054ccf93c35306dda6935942..dc652aad74725136a72dc9f277dcd50b535ef9d1 100644 (file)
@@ -12,7 +12,7 @@
  * by PostgreSQL
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.530 2009/03/22 16:44:26 tgl Exp $
+ *   $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.531 2009/03/26 22:26:07 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -5004,7 +5004,9 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
            numConstrs = PQntuples(res);
            if (numConstrs != tbinfo->ncheck)
            {
-               write_msg(NULL, "expected %d check constraints on table \"%s\" but found %d\n",
+               write_msg(NULL, ngettext("expected %d check constraint on table \"%s\" but found %d\n",
+                                        "expected %d check constraints on table \"%s\" but found %d\n",
+                                        tbinfo->ncheck),
                          tbinfo->ncheck, tbinfo->dobj.name, numConstrs);
                write_msg(NULL, "(The system catalogs might be corrupted.)\n");
                exit_nicely();
@@ -6335,7 +6337,9 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo)
    ntups = PQntuples(res);
    if (ntups != 1)
    {
-       write_msg(NULL, "query returned %d rows instead of one: %s\n",
+       write_msg(NULL, ngettext("query returned %d row instead of one: %s\n",
+                                "query returned %d rows instead of one: %s\n",
+                                ntups),
                  ntups, query->data);
        exit_nicely();
    }
@@ -6532,7 +6536,9 @@ dumpDomain(Archive *fout, TypeInfo *tinfo)
    ntups = PQntuples(res);
    if (ntups != 1)
    {
-       write_msg(NULL, "query returned %d rows instead of one: %s\n",
+       write_msg(NULL, ngettext("query returned %d row instead of one: %s\n",
+                                "query returned %d rows instead of one: %s\n",
+                                ntups),
                  ntups, query->data);
        exit_nicely();
    }
@@ -7181,7 +7187,9 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
    ntups = PQntuples(res);
    if (ntups != 1)
    {
-       write_msg(NULL, "query returned %d rows instead of one: %s\n",
+       write_msg(NULL, ngettext("query returned %d row instead of one: %s\n",
+                                "query returned %d rows instead of one: %s\n",
+                                ntups),
                  ntups, query->data);
        exit_nicely();
    }
@@ -10518,7 +10526,9 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
 
    if (PQntuples(res) != 1)
    {
-       write_msg(NULL, "query to get data of sequence \"%s\" returned %d rows (expected 1)\n",
+       write_msg(NULL, ngettext("query to get data of sequence \"%s\" returned %d row (expected 1)\n",
+                                "query to get data of sequence \"%s\" returned %d rows (expected 1)\n",
+                                PQntuples(res)),
                  tbinfo->dobj.name, PQntuples(res));
        exit_nicely();
    }
index fe3f6a46bce584411f1b240f3f4c3a495e966a11..0649573b3ed114604544eb53425a0582515a79b3 100644 (file)
@@ -8,7 +8,7 @@
  *
  * Copyright (c) 2000-2009, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.202 2009/03/25 13:11:43 petere Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.203 2009/03/26 22:26:07 petere Exp $
  */
 #include "postgres_fe.h"
 
@@ -1891,10 +1891,8 @@ describeRoles(const char *pattern, bool verbose)
 
            if (conns == 0)
                appendPQExpBuffer(&buf, _("No connections"));
-           else if (conns == 1)
-               appendPQExpBuffer(&buf, _("1 connection"));
            else
-               appendPQExpBuffer(&buf, _("%d connections"), conns);
+               appendPQExpBuffer(&buf, ngettext("1 connection", "%d connections", conns), conns);
        }
 
        attr[i] = pg_strdup(buf.data);
index 52de0d9463fc27999f48338cb1bf303e75d0377e..1ebf488b35fd1c123a9debb02248b57405d9e8f9 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2009, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.110 2009/01/01 17:23:55 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.111 2009/03/26 22:26:07 petere Exp $
  */
 #include "postgres_fe.h"
 
@@ -2348,10 +2348,7 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout, FILE *f
        char        default_footer[100];
 
        total_records = opt->topt.prior_records + cont.nrows;
-       if (total_records == 1)
-           snprintf(default_footer, 100, _("(1 row)"));
-       else
-           snprintf(default_footer, 100, _("(%lu rows)"), total_records);
+       snprintf(default_footer, 100, ngettext("(1 row)", "(%lu rows)", total_records), total_records);
 
        printTableAddFooter(&cont, default_footer);
    }
index 9a6ba3cf2a479e27385079c39217f0dd31823ae8..8443c51e7805794abe85af1fbbbfb12896a5110a 100644 (file)
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/c.h,v 1.234 2009/01/01 17:23:55 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.235 2009/03/26 22:26:07 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -97,6 +97,8 @@
 #else
 #define gettext(x) (x)
 #define dgettext(d,x) (x)
+#define ngettext(s,p,n) ((n) == 1 ? (s) : (p))
+#define dngettext(d,s,p,n) ((n) == 1 ? (s) : (p))
 #endif
 
 /*
index 9dbe589b92025868c17cf25ee5f2f22168c049aa..55ff8d23c8c553ad332f35e87b194d8546d29221 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.47 2009/01/26 10:19:44 petere Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.48 2009/03/26 22:26:08 petere Exp $ */
 
 #include "postgres_fe.h"
 
@@ -496,7 +496,9 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
    }
 
    if (pointer_len > 2)
-       mmerror(PARSE_ERROR, ET_FATAL, "multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len);
+       mmerror(PARSE_ERROR, ET_FATAL, ngettext("multilevel pointers (more than 2 levels) are not supported; found %d level",
+                                               "multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len),
+           pointer_len);
 
    if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char)
        mmerror(PARSE_ERROR, ET_FATAL, "pointer to pointer is not supported for this data type");
index cff12961ebd33b8997d24c9a4abd6dc16fd19e17..573d293f4ccfce01e4f4834eee58220104399c5e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.235 2009/02/23 10:03:22 petere Exp $
+ *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.236 2009/03/26 22:26:08 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -4088,7 +4088,8 @@ exec_eval_expr(PLpgSQL_execstate *estate,
    if (estate->eval_tuptable->tupdesc->natts != 1)
        ereport(ERROR,
                (errcode(ERRCODE_SYNTAX_ERROR),
-                errmsg("query \"%s\" returned %d columns", expr->query,
+                errmsg(dngettext(TEXTDOMAIN, "query \"%s\" returned %d column", "query \"%s\" returned %d columns", estate->eval_tuptable->tupdesc->natts),
+                       expr->query,
                        estate->eval_tuptable->tupdesc->natts)));
 
    /*
index 27324b3ff3556735df497190f7c6bd91aead0b05..4914899a8992022f322d1128ccecc694fab157f8 100644 (file)
@@ -1,7 +1,7 @@
 /**********************************************************************
  * plpython.c - python as a procedural language for PostgreSQL
  *
- * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.118 2009/01/15 13:49:56 petere Exp $
+ * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.119 2009/03/26 22:26:08 petere Exp $
  *
  *********************************************************************
  */
@@ -2523,7 +2523,7 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, long limit)
                     PLy_procedure_name(PLy_curr_procedure));
        sv = PyString_AsString(so);
        PLy_exception_set(PLy_exc_spi_error,
-                         "Expected sequence of %d arguments, got %d: %s",
+                         dngettext(TEXTDOMAIN, "Expected sequence of %d argument, got %d: %s", "Expected sequence of %d arguments, got %d: %s", plan->nargs),
                          plan->nargs, nargs, sv);
        Py_DECREF(so);