Re: [BUGS] BUG #4186: set lc_messages does not work - Mailing list pgsql-hackers
From | Hiroshi Inoue |
---|---|
Subject | Re: [BUGS] BUG #4186: set lc_messages does not work |
Date | |
Msg-id | 49754A6C.6050802@tpf.co.jp Whole thread Raw |
In response to | Re: [BUGS] BUG #4186: set lc_messages does not work (Magnus Hagander <magnus@hagander.net>) |
Responses |
Re: [BUGS] BUG #4186: set lc_messages does not work
|
List | pgsql-hackers |
Magnus Hagander wrote: > Hiroshi Inoue wrote: >> Hiroshi Inoue wrote: >>> Magnus Hagander wrote: >>>> Do you want to send an updated patch for it, or do you want me to look >>>> at it? >>> I would send a new patch to which I added a simple ISO style check for >>> locale names. >> Attached is a new patch. >> I added a simple ISO style locale name check. >> Avoided codings like *NULL == somthing*. >> It also includes the changes to mbutils.c and elog.c which fix >> recently introduced bug by the domain name change from "postgres" >> to "postgres-8.4". > > Attached is a further updated version of this patch. Changes include: Thanks. > * Actually avoid NULL==something style coding everywhere (I think) > * Avoid coding like "if (ret = putenvFunc(envval), 0 != ret)" > * Per discussion, remove pg_locale.c specific coding, put it in > src/port, and do a redefine so we *always* use these new functions > * Some further minor cleanups > * Removed the change to mbutils.c and elog.c - those are a separate > issue, will deal with those as a separate patch. > > There still needs to be some error checking added in IsoLocaleName(), > but this is a start. > > Can someone please test this? :-) OK I would check it tonight. Please note the patch relies on the proper gettext module. The header, lib and dlls are placed on Saito-san's site http://winpg.jp/~saito/pg_work/LC_MESSAGE_CHECK/libintl_check/ . Also note the current source tries to find the message catalog postgres-8.4.mo not postgres.mo. The attached is an example patch to change the name of mo files at installation time. I'm not good at perl and there may be cleaner way. regards, Hiroshi Inoue *** Install_orig.pm Wed Sep 17 13:31:08 2008 --- Install.pm Sat Jan 10 21:15:59 2009 *************** *** 460,465 **** --- 460,478 ---- print "Installing NLS files..."; EnsureDirectories($target, "share/locale"); + + my $majorver; + open(F, "src/include/pg_config.h") || confess "Could not open file pg_config.h\n"; + while (<F>) + { + if (/^#define\s+PG_MAJORVERSION\s+"([^"]+)"/) + { + $majorver = $1; + } + } + print "majorver=$majorver\n"; + close(F); + my @flist; File::Find::find({wanted => sub { /^nls\.mk\z/s && *************** *** 481,487 **** EnsureDirectories($target, "share/locale/$lang", "share/locale/$lang/LC_MESSAGES"); system( ! "\"$nlspath\\bin\\msgfmt\" -o \"$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm.mo\" $_" ) && croak("Could not run msgfmt on $dir\\$_"); print "."; --- 494,500 ---- EnsureDirectories($target, "share/locale/$lang", "share/locale/$lang/LC_MESSAGES"); system( ! "\"$nlspath\\bin\\msgfmt\" -o \"$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo\" $_" ) && croak("Could not run msgfmt on $dir\\$_"); print ".";
pgsql-hackers by date: