> to_char's month/day name localization is implemented with
> gettext() not strftime(), which is why it depends on
> LC_MESSAGES not LC_TIME. I seem to recall that we didn't
> like the side-effects of the patch you are mentioning, and so
> it ended up being rejected outright.
Correct. I have been looking for the cause of this problem and
these are my finding:
1. The platforms discussed and tested here are MS Windows XP and 2003 using
Microsoft VC++ 2005 and NOT MINGW.
2. As Tom described above, to_char is implemented with gettext which depends
on LC_MESSAGES. I guess this is okay.
3. Changing LC_MESSAGES is done in pg_locale.c:94:pg_perm_setlocale by
setting LC_MESSAGES environment variable. This works for MINGW (tested by
installing PG 8.2.6), but it does not work for MSVC++ due different locale
handling of gettext. Please see gettext sources:1087:localenames.c
4. Locale names are different in MS Windows. I created a C app to test
gettext on Windows.
setting LC_MESSAGES to Spanisg_Spain and German_Germany works but es_ES and
de_DE do not :(
SET LC_MESSAGES to '....' has no effect because:
A. gettext compiled/linked in MSVC looks for the locale of the current
thread and NOT the LC_MESSAGES,LANGIAGE,LANG... environment variables. See
gettext's sources....
B. Given current thread's locale Spanish_Spain, gettext fails to find a
directory called "Spanish_Spain" in share/locale. As result English names
are returned.
A possible solutions:
- Keep to_char/LC_MESSAGES handling and create a fix for B.
Because we do not want to change/maintain our own version of Gettext this
would also involve creating a different directory/name structure for
Windows. For example share\locale\de would be share\locale\German_Germany.
Any thoughts,
Regards,
Gevik Babakhani
------------------------------------------------
PostgreSQL NL http://www.postgresql.nl
TrueSoftware BV http://www.truesoftware.nl
------------------------------------------------