Re: [HACKERS] Day and month name localization uses wrong locale category

2007-02-14 Thread Bruce Momjian

Added to TODO:

o Use LC_TIME for localized weekday/month names, rather than
  LC_MESSAGES

  http://archives.postgresql.org/pgsql-hackers/2006-11/msg00390.php

---

Euler Taveira de Oliveira wrote:
> Peter Eisentraut wrote:
> 
> > > What about using strftime()? So we couldn't worry about gettext
> > > translations; "all" is localized.
> > > Why didn't I think it before? :-)
> > >
> > > I'll try to code a patch today later if noone objects.
> > 
> > How is this going?
> > 
> Finished. Sorry for the delay I had some trouble understanding how
> backend treats the locale stuff (Neil pointed out the path).
> Now TM mode is returning strftime() output. It would be nice if in the
> future we change this to pg_strftime() but unfortunately the last one is
> not i18n. :(
> 
> template1=# show lc_time;
>  lc_time
> -
>  pt_BR
> (1 registro)
> 
> template1=# select to_char(now(), 'TMDay, DD TMMonth ');
>   to_char
> ---
>  Segunda, 20 Novembro 2006
> (1 registro)
> 
> template1=# set lc_time to 'C';
> SET
> template1=# select to_char(now(), 'TMDay, DD TMMonth ');
>  to_char
> --
>  Monday, 20 November 2006
> (1 registro)
> 
> template1=# set lc_time to 'de_DE';
> SET
> template1=# select to_char(now(), 'TMDay, DD TMMonth ');
>  to_char
> --
>  Montag, 20 November 2006
> (1 registro)
> 
> template1=#
> 
> 
> Comments?
> 
> -- 
>   Euler Taveira de Oliveira
>   http://www.timbira.com/

[ Attachment, skipping... ]

> 
> ---(end of broadcast)---
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>choose an index scan if your joining column's datatypes do not
>match

-- 
  Bruce Momjian  <[EMAIL PROTECTED]>  http://momjian.us
  EnterpriseDB   http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [HACKERS] Day and month name localization uses wrong locale category

2007-02-13 Thread Bruce Momjian

Would someone update this patch with the optimization below.  The patch
is at?

http://momjian.postgresql.org/cgi-bin/pgpatches_hold

---

Tom Lane wrote:
> Peter Eisentraut <[EMAIL PROTECTED]> writes:
> > What's concerning me about the way this is written is that it calls 
> > setlocale() for each formatting instance, which will be very slow.
> 
> Perhaps, the first time the info is needed, do setlocale(), ask strftime
> for the 12+7 strings we need and save them away, then revert to C locale
> and proceed from there.
> 
>   regards, tom lane
> 
> ---(end of broadcast)---
> TIP 3: Have you checked our extensive FAQ?
> 
>http://www.postgresql.org/docs/faq

-- 
  Bruce Momjian  <[EMAIL PROTECTED]>  http://momjian.us
  EnterpriseDB   http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [HACKERS] Day and month name localization uses wrong locale category

2006-11-17 Thread Euler Taveira de Oliveira
Peter Eisentraut wrote:

> [EMAIL PROTECTED]:~$ date +%A
> Friday
> 
> [EMAIL PROTECTED]:~$ [EMAIL PROTECTED] date +%A
> Friday
> 
> [EMAIL PROTECTED]:~$ [EMAIL PROTECTED] date +%A
> Freitag
> 
> Is there no API to get the localized names from the C library so that LC_TIME 
> takes effect?
> 
What about using strftime()? So we couldn't worry about gettext
translations; "all" is localized.
Why didn't I think it before? :-)

I'll try to code a patch today later if noone objects.

PS> I was thinking about changing this for the same reasons Peter
pointed out; I didn't have the time to do it before. 

-- 
  Euler Taveira de Oliveira
  http://www.timbira.com/


---(end of broadcast)---
TIP 6: explain analyze is your friend


[HACKERS] Day and month name localization uses wrong locale category

2006-11-17 Thread Peter Eisentraut
In 8.2, utils/adt/formatting.c uses our NLS mechanism to localize day and 
month names (I assume for use by to_char).  But since this necessarily ties 
the outcome to the LC_MESSAGES setting, this comes out inconsistently with 
Unix locale behavior, e.g.,

[EMAIL PROTECTED]:~$ locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

[EMAIL PROTECTED]:~$ date +%A
Friday

[EMAIL PROTECTED]:~$ [EMAIL PROTECTED] date +%A
Friday

[EMAIL PROTECTED]:~$ [EMAIL PROTECTED] date +%A
Freitag

Is there no API to get the localized names from the C library so that LC_TIME 
takes effect?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq