[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Time string format
From: |
David De La Harpe Golden |
Subject: |
Re: Time string format |
Date: |
Sat, 20 Nov 2010 03:47:13 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101030 Icedove/3.0.10 |
On 19/11/10 18:42, Eli Zaretskii wrote:
time.el:display-time-string-forms believes that the right format for
displaying the date in the mode-line tooltip is "%a %b %e, %Y". This
is not necessarily TRT in languages other than English,
Or even in English... Americans speak an English dialect but have that
awkward habit of putting the month first. But that's mainly an issue
when they use all-numeric dates, I expect an American could cope with
"%a %d %b %Y" which is used by a lot of locales including english
speaking ones - and in fact we see the "en_US.UTF-8" locale on my system
apparently uses that order in its %c, unlike the "C" locale.
Would it be a good idea to have an element of language-info-alist that
provides a proper format for this?
Probably not? language-info-alist is AFAICS a list of emacs' "language
environments", which are not at all 1:1 to locales. Emacs does
auto-pick its language env based on your locale, unless you set one
explicitly (I always just set current-language-environment to UTF-8...),
but e.g. it picks the same language env "English" for several locales
that happen to be english-speaking, but which have different D_FMTs.
# just some example locale info
# nl_langinfo(D_T_FMT) is just what strftime uses for %c,
# nl_langinfo(D_FMT) for %x and nl_langinfo(T_FMT) for %X
# a.out just being a program that calls nl_langinfo and strftime
$ export LC_ALL=C
$ ./a.out '%c || %X || %x'
nl_langinfo(D_T_FMT): "%a %b %e %H:%M:%S %Y"
nl_langinfo(T_FMT): "%H:%M:%S"
nl_langinfo(D_FMT): "%m/%d/%y"
strftime("%c || %X || %x"): "Sat Nov 20 03:16:15 2010 || 03:16:15 ||
11/20/10"
$ export LC_ALL=en_US.UTF-8
$ ./a.out '%c || %X || %x'
nl_langinfo(D_T_FMT): "%a %d %b %Y %r %Z"
nl_langinfo(T_FMT): "%r"
nl_langinfo(D_FMT): "%m/%d/%Y"
strftime("%c || %X || %x"): "Sat 20 Nov 2010 03:16:29 AM GMT || 03:16:29
AM || 11/20/2010"
$ export LC_ALL=en_IE.UTF-8
$ ./a.out '%c || %X || %x'
nl_langinfo(D_T_FMT): "%a %d %b %Y %T %Z"
nl_langinfo(T_FMT): "%T"
nl_langinfo(D_FMT): "%d/%m/%y"
strftime("%c || %X || %x"): "Sat 20 Nov 2010 03:16:38 GMT || 03:16:38 ||
20/11/10"
$ export LC_ALL=ga_IE.UTF-8
$ ./a.out '%c || %X || %x'
nl_langinfo(D_T_FMT): "%a %d %b %Y %T %Z"
nl_langinfo(T_FMT): "%T"
nl_langinfo(D_FMT): "%d.%m.%y"
strftime("%c || %X || %x"): "Sath 20 Samh 2010 03:17:04 GMT || 03:17:04
|| 20.11.10"
$ export LC_ALL=fr_FR.UTF-8
$ ./a.out '%c || %X || %x'
nl_langinfo(D_T_FMT): "%a %d %b %Y %T %Z"
nl_langinfo(T_FMT): "%T"
nl_langinfo(D_FMT): "%d/%m/%Y"
strftime("%c || %X || %x"): "sam. 20 nov. 2010 03:17:15 GMT || 03:17:15
|| 20/11/2010"
$ export LC_ALL=de_DE.UTF-8
$ ./a.out '%c || %X || %x'
nl_langinfo(D_T_FMT): "%a %d %b %Y %T %Z"
nl_langinfo(T_FMT): "%T"
nl_langinfo(D_FMT): "%d.%m.%Y"
strftime("%c || %X || %x"): "Sa 20 Nov 2010 03:17:23 GMT || 03:17:23 ||
20.11.2010"
$ export LC_ALL=ja_JP.UTF-8
$ ./a.out '%c || %X || %x'
nl_langinfo(D_T_FMT): "%Y年%m月%d日 %H時%M分%S秒"
nl_langinfo(T_FMT): "%H時%M分%S秒"
nl_langinfo(D_FMT): "%Y年%m月%d日"
strftime("%c || %X || %x"): "2010年11月20日 03時17分43秒 || 03時17分43秒
|| 2010年11月20日"
Re: Time string format, Deniz Dogan, 2010/11/19
Re: Time string format,
David De La Harpe Golden <=