1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

NLS cleanup in ecpglib

Replace leftover instances of _() by ecpg_gettext(), the latter being the
correct way to refer to the library's message catalog, instead of the one of
the program using the library.

Drop NLS support for ecpg_log(), which is a debugging instrument similar to
elog() in the backend.

We cannot support NLS in the ecpg compatlib, because that requires
ecpg_gettext, which is in ecpglib, which is not a dependency of compatlib.  It
doesn't seem worthwhile to worry about this, since the only translatable
string is "out of memory", and gettext probably won't be able to do much
without memory either.

Adjust messages to project style.
This commit is contained in:
Peter Eisentraut
2009-01-15 11:52:55 +00:00
parent cbb1358b18
commit cb05ab81a8
16 changed files with 69 additions and 63 deletions

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.52 2008/12/17 16:52:07 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.53 2009/01/15 11:52:55 petere Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@ -223,7 +223,7 @@ ECPGnoticeReceiver(void *arg, const PGresult *result)
sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;
if (message == NULL) /* Shouldn't happen, but need to be sure */
message = _("No message received");
message = ecpg_gettext("empty message text");
/* these are not warnings */
if (strncmp(sqlstate, "00", 2) == 0)
@ -378,7 +378,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
if (strncmp(dbname, "unix:", 5) != 0)
{
ecpg_log("ECPGconnect: socketname %s given for TCP connection on line %d\n", host, lineno);
ecpg_raise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, realname ? realname : _("<DEFAULT>"));
ecpg_raise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, realname ? realname : ecpg_gettext("<DEFAULT>"));
if (host)
ecpg_free(host);
@ -404,7 +404,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
if (strcmp(dbname + offset, "localhost") != 0 && strcmp(dbname + offset, "127.0.0.1") != 0)
{
ecpg_log("ECPGconnect: non-localhost access via sockets on line %d\n", lineno);
ecpg_raise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, realname ? realname : _("<DEFAULT>"));
ecpg_raise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, realname ? realname : ecpg_gettext("<DEFAULT>"));
if (host)
ecpg_free(host);
if (port)
@ -471,11 +471,11 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
actual_connection = all_connections;
ecpg_log("ECPGconnect: opening database %s on %s port %s %s%s %s%s\n",
realname ? realname : _("<DEFAULT>"),
host ? host : _("<DEFAULT>"),
port ? (ecpg_internal_regression_mode ? _("<REGRESSION_PORT>") : port) : _("<DEFAULT>"),
options ? _("with options ") : "", options ? options : "",
user ? _("for user ") : "", user ? user : "");
realname ? realname : "<DEFAULT>",
host ? host : "<DEFAULT>",
port ? (ecpg_internal_regression_mode ? "<REGRESSION_PORT>" : port) : "<DEFAULT>",
options ? "with options " : "", options ? options : "",
user ? "for user " : "", user ? user : "");
connect_string = ecpg_alloc( strlen_or_null(host)
+ strlen_or_null(port)
@ -515,7 +515,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
if (PQstatus(this->connection) == CONNECTION_BAD)
{
const char *errmsg = PQerrorMessage(this->connection);
const char *db = realname ? realname : _("<DEFAULT>");
const char *db = realname ? realname : ecpg_gettext("<DEFAULT>");
ecpg_log("ECPGconnect: could not open database: %s\n", errmsg);