lc_time and localized dates
От | Euler Taveira de Oliveira |
---|---|
Тема | lc_time and localized dates |
Дата | |
Msg-id | 47C249BE.7090900@timbira.com обсуждение исходный текст |
Ответы |
Re: lc_time and localized dates
Re: lc_time and localized dates |
Список | pgsql-patches |
Hi, Attached is a patch that replaces the lc_messages with lc_time when using to_char in translation mode (TM) [1]. It doesn't change the output behaviour. Per discussion [2], it's using some cache mechanism so we don't need to call setlocale() all the time. Some issues: (i) some locales don't capitalize the first letter. I'm using pg_toupper() to do the job but I'm afraid it's not appropriated. I'm using it 'cause i'm too lazy to move localized_str_toupper(). Any suggestions? (ii) it didn't address the problem spotted at [3][4]. IMHO, it's ok for a non-superuser to set lc_time. Opinions? euler=# show lc_time; lc_time --------- pt_BR (1 registro) euler=# select to_char(now(), 'TMDay Day dy, DD TMMon Month TMmonth YYYY'); to_char -------------------------------------------------------- Segunda Monday mon, 25 Fev February fevereiro 2008 (1 registro) euler=# set lc_time to 'es_ES'; SET euler=# select to_char(now(), 'TMDay Day dy, DD TMMon Month TMmonth YYYY'); to_char ---------------------------------------------------- Lunes Monday mon, 25 Feb February febrero 2008 (1 registro) euler=# set lc_time to 'de_DE'; SET euler=# select to_char(now(), 'TMDay Day dy, DD TMMon Month TMmonth YYYY'); to_char ----------------------------------------------------- Montag Monday mon, 25 Feb February februar 2008 (1 registro) euler=# set lc_time to 'fr_FR'; SET euler=# select to_char(now(), 'TMDay Day dy, DD TMMon Month TMmonth YYYY'); to_char ---------------------------------------------------- Lundi Monday mon, 25 Fév February février 2008 (1 registro) euler=# set lc_time to 'C'; SET euler=# select to_char(now(), 'TMDay Day dy, DD TMMon Month TMmonth YYYY'); to_char ------------------------------------------------------ Monday Monday mon, 25 Feb February february 2008 (1 registro) [1] http://archives.postgresql.org/pgsql-hackers/2006-11/msg00539.php [2] http://archives.postgresql.org/pgsql-hackers/2006-11/msg00693.php [3] http://archives.postgresql.org/pgsql-hackers/2007-10/msg00214.php [4] http://archives.postgresql.org/pgsql-hackers/2006-11/msg00692.php -- Euler Taveira de Oliveira http://www.timbira.com/
Вложения
В списке pgsql-patches по дате отправления: