From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Time string format Date: Sat, 20 Nov 2010 12:28:59 +0200 Message-ID: <838w0ob85w.fsf@gnu.org> References: <83k4k9b1f9.fsf@gnu.org> <4CE744C1.40403@harpegolden.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1290249073 3046 80.91.229.12 (20 Nov 2010 10:31:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 20 Nov 2010 10:31:13 +0000 (UTC) Cc: emacs-devel@gnu.org To: David De La Harpe Golden Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 20 11:31:09 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PJkir-0000q7-1b for ged-emacs-devel@m.gmane.org; Sat, 20 Nov 2010 11:31:09 +0100 Original-Received: from localhost ([127.0.0.1]:39718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJkiq-000865-6v for ged-emacs-devel@m.gmane.org; Sat, 20 Nov 2010 05:31:08 -0500 Original-Received: from [140.186.70.92] (port=37122 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJkii-00085c-TJ for emacs-devel@gnu.org; Sat, 20 Nov 2010 05:31:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJkih-0001Ma-ML for emacs-devel@gnu.org; Sat, 20 Nov 2010 05:31:00 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:57256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJkih-0001MO-FU for emacs-devel@gnu.org; Sat, 20 Nov 2010 05:30:59 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LC600400IIFFQ00@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Sat, 20 Nov 2010 12:30:57 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.124.52.47]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LC60033MIJKNCC0@a-mtaout20.012.net.il>; Sat, 20 Nov 2010 12:30:57 +0200 (IST) In-reply-to: <4CE744C1.40403@harpegolden.net> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:132898 Archived-At: > Date: Sat, 20 Nov 2010 03:47:13 +0000 > From: David De La Harpe Golden > > 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. That's correct, but we could still leave the current default in time.el in the absence of a locale-specific format, because it is appropriate to 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. That's true, but since I was only talking about a _date_, does it really matter? See below. > 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. I wasn't talking about D_FMT, mind you. D_FMT is what %x produces, and time.el rightfully doesn't want to use that, because it produces a numeric date in most locales (as your sample clearly shows). > $ 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" Note that, in both these en_* locales, the date part of %c is the same: "Sat 20 Nov 2010". Are there any en_* locales (or any other locales that share the same language) which differ in that part? If there aren't, then we can use the language alone as the key. Also note that we already have languages such as "Brazilian Portuguese", which are really locale-specific variations of other languages; we could use the same trick for the date format, should we need that (if the answer to the previous questions is YES). If we want to use the locale as the key after all, we could add the format to locale-language-names instead, but that sounds less clean to me.