From: | Efraín López <tecnomaya(at)cabsagt(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: libpq messages language |
Date: | 2007-12-09 04:15:14 |
Message-ID: | 022401c83a1a$1bf4d510$0401a8c0@TOSHIBA |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thank you very much for your help. It worked for me.
I am using Visual C++ 2005 express
I downloaded gettext-runtime-0.13.1.bin.woe32.zip and
libiconv-1.9.1.bin.woe32.zip from
http://sourceforge.net/project/showfiles.php?group_id=25167
Then I compiled libpq with ENABLE_NLS, gettext and libiconv libs
They, I just got carefull with PGLOCALEDIR,
again, thank you!
----- Original Message -----
From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Efraín López *EXTERN*" <tecnomaya(at)cabsagt(dot)com>;
<pgsql-general(at)postgresql(dot)org>
Sent: Friday, December 07, 2007 2:52 AM
Subject: RE: [GENERAL] libpq messages language
Efraín López wrote:
>>> I am using Windows, and pg 8.2.5
>>>
>>> When making a connection with libpq, if it fails I would like
>>> to get the errors messages in spanish (PQerrorMessage )
>>>
>>> Is this possible? How can this be done?
I got it to work with this program:
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <libpq-fe.h>
int main(int argc, char **argv) {
PGconn *conn;
setlocale(LC_ALL, "");
putenv("PGLOCALEDIR=C:\\Programme\\postgres\\share\\locale");
conn = PQconnectdb("port=4711");
if (CONNECTION_OK != PQstatus(conn)) {
fprintf(stderr, "%s\n", PQerrorMessage(conn));
PQfinish(conn);
return 1;
}
PQfinish(conn);
return 0;
}
Instead of setting PGLOCALEDIR in the code, you can also define
it as environment variable on your system, that is maybe better.
It must point to the directory where your message files are installed
(you have spanish message files installed, haven't you?).
The above program assumes that there is no database running
on port 4711, so you get an error message from libpq.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Steffensen | 2007-12-09 05:21:15 | function permissions question |
Previous Message | Tom Lane | 2007-12-09 00:09:33 | Re: How to EXPLAIN statements inside a trigger function? |