From cb05ab81a857582161dd74cbfa91d4468e496cd1 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Thu, 15 Jan 2009 11:52:55 +0000
Subject: [PATCH] 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.
---
 src/interfaces/ecpg/compatlib/informix.c      |  4 +-
 src/interfaces/ecpg/ecpglib/connect.c         | 20 +++++-----
 src/interfaces/ecpg/ecpglib/data.c            |  8 ++--
 src/interfaces/ecpg/ecpglib/descriptor.c      |  4 +-
 src/interfaces/ecpg/ecpglib/error.c           | 38 +++++++++++--------
 src/interfaces/ecpg/ecpglib/execute.c         | 12 +++---
 src/interfaces/ecpg/ecpglib/misc.c            |  6 +--
 src/interfaces/ecpg/ecpglib/nls.mk            |  4 +-
 .../ecpg/test/expected/connect-test2.stderr   |  2 +-
 .../ecpg/test/expected/connect-test3.stderr   |  6 +--
 .../ecpg/test/expected/connect-test4.stderr   |  2 +-
 .../ecpg/test/expected/connect-test5.stderr   |  4 +-
 .../ecpg/test/expected/preproc-init.stderr    | 12 +++---
 .../test/expected/preproc-whenever.stderr     |  6 +--
 .../ecpg/test/expected/sql-fetch.stderr       |  2 +-
 .../ecpg/test/expected/sql-quote.stderr       |  2 +-
 16 files changed, 69 insertions(+), 63 deletions(-)

diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c
index b5ee3e67386..f58802ef361 100644
--- a/src/interfaces/ecpg/compatlib/informix.c
+++ b/src/interfaces/ecpg/compatlib/informix.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.56 2008/11/01 08:55:21 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.57 2009/01/15 11:52:54 petere Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -1010,7 +1010,7 @@ ECPG_informix_set_var(int number, void *pointer, int lineno)
 
 		sqlca->sqlcode = ECPG_OUT_OF_MEMORY;
 		strncpy(sqlca->sqlstate, "YE001", sizeof("YE001"));
-		snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), _("out of memory on line %d"), lineno);
+		snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), "out of memory on line %d", lineno);
 		sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
 		/* free all memory we have allocated for the user */
 		ECPGfree_auto_mem();
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index 48d991d5068..d73199971e8 100644
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -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);
 
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 392ebdde773..9ec78a599dc 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.41 2008/05/16 15:20:03 petere Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.42 2009/01/15 11:52:55 petere Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -60,7 +60,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
 	else
 		log_offset = offset;
 
-	ecpg_log("ecpg_get_data on line %d: RESULT: %s offset: %ld; array: %s\n", lineno, pval ? (binary ? _("BINARY") : pval) : _("EMPTY"), log_offset, isarray ? _("yes") : _("no"));
+	ecpg_log("ecpg_get_data on line %d: RESULT: %s offset: %ld; array: %s\n", lineno, pval ? (binary ? "BINARY" : pval) : "EMPTY", log_offset, isarray ? "yes" : "no");
 
 	/* We will have to decode the value */
 
@@ -360,7 +360,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
 							else
 								ecpg_raise(lineno, ECPG_CONVERT_BOOL,
 										   ECPG_SQLSTATE_DATATYPE_MISMATCH,
-										   _("different size"));
+										   NULL);
 							break;
 						}
 						else if (pval[0] == 't' && pval[1] == '\0')
@@ -372,7 +372,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
 							else
 								ecpg_raise(lineno, ECPG_CONVERT_BOOL,
 										   ECPG_SQLSTATE_DATATYPE_MISMATCH,
-										   _("different size"));
+										   NULL);
 							break;
 						}
 						else if (pval[0] == '\0' && PQgetisnull(results, act_tuple, act_field))
diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c
index 457ee04df5f..0331d12c8d7 100644
--- a/src/interfaces/ecpg/ecpglib/descriptor.c
+++ b/src/interfaces/ecpg/ecpglib/descriptor.c
@@ -1,6 +1,6 @@
 /* dynamic SQL support routines
  *
- * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.30 2008/05/16 15:20:03 petere Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.31 2009/01/15 11:52:55 petere Exp $
  */
 
 #define POSTGRES_ECPG_INTERNAL
@@ -724,6 +724,6 @@ ecpg_find_desc(int line, const char *name)
 bool
 ECPGdescribe(int line, bool input, const char *statement,...)
 {
-	ecpg_log("ECPGdescribe called on line %d for %s: %s\n", line, (input) ? _("input") : _("output"), statement);
+	ecpg_log("ECPGdescribe called on line %d for %s: %s\n", line, input ? "input" : "output", statement);
 	return false;
 }
diff --git a/src/interfaces/ecpg/ecpglib/error.c b/src/interfaces/ecpg/ecpglib/error.c
index a36f374e7d3..697862a7a0a 100644
--- a/src/interfaces/ecpg/ecpglib/error.c
+++ b/src/interfaces/ecpg/ecpglib/error.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.20 2008/05/16 15:20:03 petere Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.21 2009/01/15 11:52:55 petere Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -37,7 +37,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-					 ecpg_gettext("unsupported type %s on line %d"), str, line);
+					 ecpg_gettext("unsupported type \"%s\" on line %d"), str, line);
 			break;
 
 		case ECPG_TOO_MANY_ARGUMENTS:
@@ -58,28 +58,34 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-					 ecpg_gettext("not correctly formatted int type \"%s\" on line %d"), str, line);
+					 ecpg_gettext("invalid input syntax for type int: \"%s\", on line %d"), str, line);
 			break;
 
 		case ECPG_UINT_FORMAT:
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-					 ecpg_gettext("not correctly formatted unsigned type \"%s\" on line %d"), str, line);
+					 ecpg_gettext("invalid input syntax for type unsigned int: \"%s\", on line %d"), str, line);
 			break;
 
 		case ECPG_FLOAT_FORMAT:
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-					 ecpg_gettext("not correctly formatted floating-point type \"%s\" on line %d"), str, line);
+					 ecpg_gettext("invalid input syntax for floating-point type: \"%s\", on line %d"), str, line);
 			break;
 
 		case ECPG_CONVERT_BOOL:
-			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
-				/* translator: this string will be truncated at 149 
-				   characters expanded.  */
-					 ecpg_gettext("could not convert %s to bool on line %d"), str, line);
+			if (str)
+				snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
+						 /* translator: this string will be truncated at 149 
+							characters expanded.  */
+						 ecpg_gettext("invalid syntax for type boolean: \"%s\", on line %d"), str, line);
+			else
+				snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
+						 /* translator: this string will be truncated at 149 
+							characters expanded.  */
+						 ecpg_gettext("could not convert boolean value: size mismatch, on line %d"), line);
 			break;
 
 		case ECPG_EMPTY:
@@ -93,7 +99,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-					 ecpg_gettext("NULL value without indicator on line %d"), line);
+					 ecpg_gettext("null value without indicator on line %d"), line);
 			break;
 
 		case ECPG_NO_ARRAY:
@@ -107,7 +113,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-					 ecpg_gettext("data read from backend is not an array on line %d"), line);
+					 ecpg_gettext("data read from server is not an array on line %d"), line);
 			break;
 
 		case ECPG_ARRAY_INSERT:
@@ -121,7 +127,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-				 ecpg_gettext("no such connection %s on line %d"), str, line);
+				 ecpg_gettext("connection \"%s\" does not exist on line %d"), str, line);
 			break;
 
 		case ECPG_NOT_CONN:
@@ -135,14 +141,14 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-				 ecpg_gettext("invalid statement name %s on line %d"), str, line);
+				 ecpg_gettext("invalid statement name \"%s\" on line %d"), str, line);
 			break;
 
 		case ECPG_UNKNOWN_DESCRIPTOR:
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-				 ecpg_gettext("descriptor %s not found on line %d"), str, line);
+				 ecpg_gettext("descriptor \"%s\" not found on line %d"), str, line);
 			break;
 
 		case ECPG_INVALID_DESCRIPTOR_INDEX:
@@ -156,7 +162,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
 			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
 				/* translator: this string will be truncated at 149 
 				   characters expanded.  */
-				 ecpg_gettext("unknown descriptor item %s on line %d"), str, line);
+				 ecpg_gettext("unrecognized descriptor item \"%s\" on line %d"), str, line);
 			break;
 
 		case ECPG_VAR_NOT_NUMERIC:
@@ -304,5 +310,5 @@ sqlprint(void)
 	struct sqlca_t *sqlca = ECPGget_sqlca();
 
 	sqlca->sqlerrm.sqlerrmc[sqlca->sqlerrm.sqlerrml] = '\0';
-	fprintf(stderr, _("sql error: %s\n"), sqlca->sqlerrm.sqlerrmc);
+	fprintf(stderr, ecpg_gettext("SQL error: %s\n"), sqlca->sqlerrm.sqlerrmc);
 }
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index a6e58f0eaea..1605ec0dc8a 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.78 2008/05/16 15:20:03 petere Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.79 2009/01/15 11:52:55 petere Exp $ */
 
 /*
  * The aim is to get a simpler inteface to the database routines.
@@ -301,7 +301,7 @@ ecpg_is_type_an_array(int type, const struct statement * stmt, const struct vari
 		return (ECPG_ARRAY_ERROR);
 
 	ecpg_type_infocache_push(&(stmt->connection->cache_head), type, isarray, stmt->lineno);
-	ecpg_log("ecpg_is_type_an_array on line %d: type (%d); C (%d); array (%s)\n", stmt->lineno, type, var->type, isarray ? _("yes") : _("no"));
+	ecpg_log("ecpg_is_type_an_array on line %d: type (%d); C (%d); array (%s)\n", stmt->lineno, type, var->type, isarray ? "yes" : "no");
 	return isarray;
 }
 
@@ -729,7 +729,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
 						for (element = 0; element < var->arrsize; element++)
 							sprintf(mallocedval + strlen(mallocedval), "%c,", (((int *) var->value)[element]) ? 't' : 'f');
 					else
-						ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, _("different size"));
+						ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
 
 					strcpy(mallocedval + strlen(mallocedval) - 1, "]");
 				}
@@ -740,7 +740,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
 					else if (var->offset == sizeof(int))
 						sprintf(mallocedval, "%c", (*((int *) var->value)) ? 't' : 'f');
 					else
-						ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, _("different size"));
+						ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
 				}
 
 				*tobeinserted_p = mallocedval;
@@ -1042,7 +1042,7 @@ free_params(const char **paramValues, int nParams, bool print, int lineno)
 	for (n = 0; n < nParams; n++)
 	{
 		if (print)
-			ecpg_log("free_params on line %d: parameter %d = %s\n", lineno, n + 1, paramValues[n] ? paramValues[n] : _("null"));
+			ecpg_log("free_params on line %d: parameter %d = %s\n", lineno, n + 1, paramValues[n] ? paramValues[n] : "null");
 		ecpg_free((void *) (paramValues[n]));
 	}
 	ecpg_free(paramValues);
@@ -1625,7 +1625,7 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
 	if (con == NULL || con->connection == NULL)
 	{
 		free_statement(stmt);
-		ecpg_raise(lineno, ECPG_NOT_CONN, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, (con) ? con->name : _("<empty>"));
+		ecpg_raise(lineno, ECPG_NOT_CONN, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, (con) ? con->name : ecpg_gettext("<empty>"));
 		setlocale(LC_NUMERIC, oldlocale);
 		ecpg_free(oldlocale);
 		return false;
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index 242ab0a7d65..47c343f7d42 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.47 2009/01/02 13:26:54 petere Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.48 2009/01/15 11:52:55 petere Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -110,7 +110,7 @@ ecpg_init(const struct connection * con, const char *connection_name, const int
 	if (con == NULL)
 	{
 		ecpg_raise(lineno, ECPG_NO_CONN, ECPG_SQLSTATE_CONNECTION_DOES_NOT_EXIST,
-				   connection_name ? connection_name : _("NULL"));
+				   connection_name ? connection_name : ecpg_gettext("NULL"));
 		return (false);
 	}
 
@@ -179,7 +179,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
 	if (!ecpg_init(con, connection_name, lineno))
 		return (false);
 
-	ecpg_log("ECPGtrans on line %d: action \"%s\"; connection \"%s\"\n", lineno, transaction, con ? con->name : _("null"));
+	ecpg_log("ECPGtrans on line %d: action \"%s\"; connection \"%s\"\n", lineno, transaction, con ? con->name : "null");
 
 	/* if we have no connection we just simulate the command */
 	if (con && con->connection)
diff --git a/src/interfaces/ecpg/ecpglib/nls.mk b/src/interfaces/ecpg/ecpglib/nls.mk
index ebe2082d8bc..86b19237317 100644
--- a/src/interfaces/ecpg/ecpglib/nls.mk
+++ b/src/interfaces/ecpg/ecpglib/nls.mk
@@ -1,5 +1,5 @@
 # $PostgreSQL $
 CATALOG_NAME	 = ecpglib
 AVAIL_LANGUAGES	 =
-GETTEXT_FILES	 = ../compatlib/informix.c connect.c data.c descriptor.c error.c execute.c misc.c prepare.c
-GETTEXT_TRIGGERS = _ ecpg_gettext ecpg_log
+GETTEXT_FILES	 = connect.c error.c execute.c misc.c
+GETTEXT_TRIGGERS = ecpg_gettext
diff --git a/src/interfaces/ecpg/test/expected/connect-test2.stderr b/src/interfaces/ecpg/test/expected/connect-test2.stderr
index 079fea21526..1709ed0b4cb 100644
--- a/src/interfaces/ecpg/test/expected/connect-test2.stderr
+++ b/src/interfaces/ecpg/test/expected/connect-test2.stderr
@@ -46,7 +46,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_get_data on line 37: RESULT: regress1 offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -220 on line 40: no such connection first on line 40
+[NO_PID]: raising sqlcode -220 on line 40: connection "first" does not exist on line 40
 [NO_PID]: sqlca: code: -220, state: 08003
 [NO_PID]: ecpg_finish: connection second closed
 [NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/connect-test3.stderr b/src/interfaces/ecpg/test/expected/connect-test3.stderr
index a7e39bf401b..370827ae6b0 100644
--- a/src/interfaces/ecpg/test/expected/connect-test3.stderr
+++ b/src/interfaces/ecpg/test/expected/connect-test3.stderr
@@ -24,7 +24,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>  
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -220 on line 35: no such connection DEFAULT on line 35
+[NO_PID]: raising sqlcode -220 on line 35: connection "DEFAULT" does not exist on line 35
 [NO_PID]: sqlca: code: -220, state: 08003
 [NO_PID]: ECPGconnect: connection identifier second is already in use
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -32,7 +32,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: connection first closed
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -220 on line 40: no such connection CURRENT on line 40
+[NO_PID]: raising sqlcode -220 on line 40: connection "CURRENT" does not exist on line 40
 [NO_PID]: sqlca: code: -220, state: 08003
-[NO_PID]: raising sqlcode -220 on line 41: no such connection DEFAULT on line 41
+[NO_PID]: raising sqlcode -220 on line 41: connection "DEFAULT" does not exist on line 41
 [NO_PID]: sqlca: code: -220, state: 08003
diff --git a/src/interfaces/ecpg/test/expected/connect-test4.stderr b/src/interfaces/ecpg/test/expected/connect-test4.stderr
index 3c293b2dc70..c0d518ed797 100644
--- a/src/interfaces/ecpg/test/expected/connect-test4.stderr
+++ b/src/interfaces/ecpg/test/expected/connect-test4.stderr
@@ -2,5 +2,5 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>  
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -220 on line 17: no such connection DEFAULT on line 17
+[NO_PID]: raising sqlcode -220 on line 17: connection "DEFAULT" does not exist on line 17
 [NO_PID]: sqlca: code: -220, state: 08003
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.stderr b/src/interfaces/ecpg/test/expected/connect-test5.stderr
index 8e0d385e969..ea6f9e2591c 100644
--- a/src/interfaces/ecpg/test/expected/connect-test5.stderr
+++ b/src/interfaces/ecpg/test/expected/connect-test5.stderr
@@ -50,7 +50,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: raising sqlcode -402 on line 56: could not connect to database "connectdb" on line 56
 [NO_PID]: sqlca: code: -402, state: 08001
-[NO_PID]: raising sqlcode -220 on line 57: no such connection main on line 57
+[NO_PID]: raising sqlcode -220 on line 57: connection "main" does not exist on line 57
 [NO_PID]: sqlca: code: -220, state: 08003
 [NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT>  for user connectdb
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -62,5 +62,5 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: connection main closed
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -220 on line 68: no such connection nonexistant on line 68
+[NO_PID]: raising sqlcode -220 on line 68: connection "nonexistant" does not exist on line 68
 [NO_PID]: sqlca: code: -220, state: 08003
diff --git a/src/interfaces/ecpg/test/expected/preproc-init.stderr b/src/interfaces/ecpg/test/expected/preproc-init.stderr
index 22085a25673..1b6fa18d614 100644
--- a/src/interfaces/ecpg/test/expected/preproc-init.stderr
+++ b/src/interfaces/ecpg/test/expected/preproc-init.stderr
@@ -1,14 +1,14 @@
 [NO_PID]: ECPGdebug: set to 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -220 on line 88: no such connection NULL on line 88
+[NO_PID]: raising sqlcode -220 on line 88: connection "NULL" does not exist on line 88
 [NO_PID]: sqlca: code: -220, state: 08003
-[NO_PID]: raising sqlcode -220 on line 90: no such connection NULL on line 90
+[NO_PID]: raising sqlcode -220 on line 90: connection "NULL" does not exist on line 90
 [NO_PID]: sqlca: code: -220, state: 08003
-[NO_PID]: raising sqlcode -220 on line 92: no such connection NULL on line 92
+[NO_PID]: raising sqlcode -220 on line 92: connection "NULL" does not exist on line 92
 [NO_PID]: sqlca: code: -220, state: 08003
-[NO_PID]: raising sqlcode -220 on line 94: no such connection NULL on line 94
+[NO_PID]: raising sqlcode -220 on line 94: connection "NULL" does not exist on line 94
 [NO_PID]: sqlca: code: -220, state: 08003
-[NO_PID]: raising sqlcode -220 on line 96: no such connection NULL on line 96
+[NO_PID]: raising sqlcode -220 on line 96: connection "NULL" does not exist on line 96
 [NO_PID]: sqlca: code: -220, state: 08003
-[NO_PID]: raising sqlcode -220 on line 98: no such connection NULL on line 98
+[NO_PID]: raising sqlcode -220 on line 98: connection "NULL" does not exist on line 98
 [NO_PID]: sqlca: code: -220, state: 08003
diff --git a/src/interfaces/ecpg/test/expected/preproc-whenever.stderr b/src/interfaces/ecpg/test/expected/preproc-whenever.stderr
index 168dc7c50a4..228b2a6066a 100644
--- a/src/interfaces/ecpg/test/expected/preproc-whenever.stderr
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever.stderr
@@ -37,7 +37,7 @@ LINE 1: select * from nonexistant
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: raising sqlstate 42P01 (sqlcode -400) on line 39: relation "nonexistant" does not exist on line 39
 [NO_PID]: sqlca: code: -400, state: 42P01
-sql error: relation "nonexistant" does not exist on line 39
+SQL error: relation "nonexistant" does not exist on line 39
 [NO_PID]: ECPGtrans on line 40: action "rollback"; connection "regress1"
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 43: query: select * from nonexistant; with 0 parameter(s) on connection regress1
@@ -51,7 +51,7 @@ LINE 1: select * from nonexistant
 [NO_PID]: raising sqlstate 42P01 (sqlcode -400) on line 43: relation "nonexistant" does not exist on line 43
 [NO_PID]: sqlca: code: -400, state: 42P01
 Error in statement 'select':
-sql error: relation "nonexistant" does not exist on line 43
+SQL error: relation "nonexistant" does not exist on line 43
 [NO_PID]: ECPGtrans on line 44: action "rollback"; connection "regress1"
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 47: query: select * from nonexistant; with 0 parameter(s) on connection regress1
@@ -65,7 +65,7 @@ LINE 1: select * from nonexistant
 [NO_PID]: raising sqlstate 42P01 (sqlcode -400) on line 47: relation "nonexistant" does not exist on line 47
 [NO_PID]: sqlca: code: -400, state: 42P01
 Found another error
-sql error: relation "nonexistant" does not exist on line 47
+SQL error: relation "nonexistant" does not exist on line 47
 [NO_PID]: ECPGtrans on line 48: action "rollback"; connection "regress1"
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 51: query: select * from nonexistant; with 0 parameter(s) on connection regress1
diff --git a/src/interfaces/ecpg/test/expected/sql-fetch.stderr b/src/interfaces/ecpg/test/expected/sql-fetch.stderr
index 211dd0f47ea..4a9d331464d 100644
--- a/src/interfaces/ecpg/test/expected/sql-fetch.stderr
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.stderr
@@ -142,6 +142,6 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: raising sqlstate 55006 (sqlcode -400) on line 53: cannot drop "my_table" because it is being used by active queries in this session on line 53
 [NO_PID]: sqlca: code: -400, state: 55006
-sql error: cannot drop "my_table" because it is being used by active queries in this session on line 53
+SQL error: cannot drop "my_table" because it is being used by active queries in this session on line 53
 [NO_PID]: ecpg_finish: connection regress1 closed
 [NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-quote.stderr b/src/interfaces/ecpg/test/expected/sql-quote.stderr
index fd77b01b9bd..33227eb81ca 100644
--- a/src/interfaces/ecpg/test/expected/sql-quote.stderr
+++ b/src/interfaces/ecpg/test/expected/sql-quote.stderr
@@ -28,7 +28,7 @@
 [NO_PID]: sqlca: code: 0, state: 22P06
 [NO_PID]: ecpg_execute on line 26: OK: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 22P06
-sql error: nonstandard use of \\ in a string literal
+SQL error: nonstandard use of \\ in a string literal
 [NO_PID]: ecpg_execute on line 28: query: insert into "My_Table" values ( 1 , E'a\\\\b' ); with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 28: using PQexec
-- 
GitLab