all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: David De La Harpe Golden <david@harpegolden.net>
Cc: emacs-devel@gnu.org
Subject: Re: Time string format
Date: Sat, 20 Nov 2010 12:28:59 +0200	[thread overview]
Message-ID: <838w0ob85w.fsf@gnu.org> (raw)
In-Reply-To: <4CE744C1.40403@harpegolden.net>

> Date: Sat, 20 Nov 2010 03:47:13 +0000
> From: David De La Harpe Golden <david@harpegolden.net>
> 
> 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.



  reply	other threads:[~2010-11-20 10:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19 18:42 Time string format Eli Zaretskii
2010-11-19 18:51 ` Lennart Borgman
2010-11-19 19:03   ` Eli Zaretskii
2010-11-19 19:36     ` Lennart Borgman
2010-11-19 22:15       ` Eli Zaretskii
2010-11-20  1:25         ` Lennart Borgman
2010-11-20  9:43           ` Eli Zaretskii
2010-11-20 12:08             ` Lennart Borgman
2010-11-20 12:38               ` Eli Zaretskii
2010-11-20 13:34                 ` Lennart Borgman
2010-11-20 13:36                   ` Lennart Borgman
2010-11-20 15:39                     ` Eli Zaretskii
2010-11-20 16:17                       ` Lennart Borgman
2010-11-20 16:39                         ` Eli Zaretskii
2010-11-20 16:49                         ` Óscar Fuentes
2010-11-21 13:53                           ` Stephen J. Turnbull
2010-11-21 13:55                             ` Lennart Borgman
2010-11-21 14:25                               ` Stephen J. Turnbull
2010-11-21 16:07                                 ` Lennart Borgman
2010-11-22  4:19                                   ` Stephen J. Turnbull
2010-11-22 11:27                                     ` Lennart Borgman
2010-11-21 15:23                               ` Harald Hanche-Olsen
2010-11-20 15:30                   ` Eli Zaretskii
2010-11-20 15:39                     ` Lennart Borgman
2010-11-20 15:43                       ` Eli Zaretskii
2010-11-20  2:49 ` Deniz Dogan
2010-11-20 10:09   ` Eli Zaretskii
2010-11-20  3:47 ` David De La Harpe Golden
2010-11-20 10:28   ` Eli Zaretskii [this message]
2010-11-20 18:10     ` David De La Harpe Golden
2010-11-20 21:23       ` David De La Harpe Golden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838w0ob85w.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=david@harpegolden.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.