Hiroshi Saito wrote:
> Hi.
>
> Ummm, I present is not understood by the reason of Japanese. ...
> Therefore, It was made into the Spanish case. I know that Alvaro-san will
> understand Spanish well.
>
> ==postgresql.conf==
> lc_messages= 'es'
>
> server.log of a patch before and after was applied. Please see it.
Understood. In fact, after having a look at this patch and giving it a
little refactoring I think it's pretty obvious; right now we're calling
bind_textdomain_codeset only for the main domain, and with this patch we
also set it for all other domains we use.
Does this patch work for you?
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
Index: src/backend/utils/init/miscinit.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/init/miscinit.c,v
retrieving revision 1.172
diff -c -p -r1.172 miscinit.c
*** src/backend/utils/init/miscinit.c 5 Jan 2009 13:57:12 -0000 1.172
--- src/backend/utils/init/miscinit.c 7 Mar 2009 22:13:47 -0000
*************** pg_bindtextdomain(const char *domain)
*** 1241,1246 ****
--- 1241,1248 ----
get_locale_path(my_exec_path, locale_path);
bindtextdomain(domain, locale_path);
+
+ SetDomainCodeSet(domain, GetDatabaseEncoding());
}
#endif
}
Index: src/backend/utils/mb/mbutils.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/mb/mbutils.c,v
retrieving revision 1.79
diff -c -p -r1.79 mbutils.c
*** src/backend/utils/mb/mbutils.c 2 Mar 2009 15:10:09 -0000 1.79
--- src/backend/utils/mb/mbutils.c 7 Mar 2009 22:13:47 -0000
*************** SetDatabaseEncoding(int encoding)
*** 895,912 ****
* On Windows, we need to explicitly bind gettext to the correct
* encoding, because gettext() tends to get confused.
*/
#if defined(ENABLE_NLS) && defined(WIN32)
! {
! int i;
! for (i = 0; i < sizeof(codeset_map_array) / sizeof(codeset_map_array[0]); i++)
{
! if (codeset_map_array[i].encoding == encoding)
! {
! if (bind_textdomain_codeset(textdomain(NULL), codeset_map_array[i].codeset) == NULL)
! elog(LOG, "bind_textdomain_codeset failed");
! break;
! }
}
}
#endif
--- 895,916 ----
* On Windows, we need to explicitly bind gettext to the correct
* encoding, because gettext() tends to get confused.
*/
+ SetDomainCodeSet(textdomain(NULL), encoding);
+ }
+
+ void
+ SetDomainCodeSet(const char *domainname, int encoding)
+ {
#if defined(ENABLE_NLS) && defined(WIN32)
! int i;
! for (i = 0; i < sizeof(codeset_map_array) / sizeof(codeset_map_array[0]); i++)
! {
! if (codeset_map_array[i].encoding == encoding)
{
! if (bind_textdomain_codeset(domainname, codeset_map_array[i].codeset) == NULL)
! elog(LOG, "bind_textdomain_codeset failed");
! break;
}
}
#endif
Index: src/include/mb/pg_wchar.h
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/include/mb/pg_wchar.h,v
retrieving revision 1.84
diff -c -p -r1.84 pg_wchar.h
*** src/include/mb/pg_wchar.h 10 Feb 2009 19:29:39 -0000 1.84
--- src/include/mb/pg_wchar.h 7 Mar 2009 22:21:51 -0000
*************** extern const char *pg_get_client_encodin
*** 392,397 ****
--- 392,398 ----
extern void SetDatabaseEncoding(int encoding);
extern int GetDatabaseEncoding(void);
extern const char *GetDatabaseEncodingName(void);
+ extern void SetDomainCodeSet(const char *domainname, int encoding);
extern int pg_valid_client_encoding(const char *name);
extern int pg_valid_server_encoding(const char *name);
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers