GNU bug report logs - #39248
format-time-string ignores user's preferred locale

Previous Next

Package: emacs;

Reported by: "Paul W. Rankin" <hello <at> paulwrankin.com>

Date: Thu, 23 Jan 2020 03:54:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#39248: closed (format-time-string ignores user's preferred
 locale)
Date: Sun, 26 Jan 2020 08:36:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 26 Jan 2020 00:35:31 -0800
with message-id <b78f6c31-e7c6-2384-d2a5-9ea69db0dcbd <at> cs.ucla.edu>
and subject line Re: bug#39248: format-time-string ignores user's preferred locale
has caused the debbugs.gnu.org bug report #39248,
regarding format-time-string ignores user's preferred locale
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
39248: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=39248
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: "Paul W. Rankin" <hello <at> paulwrankin.com>
To: bug-gnu-emacs <at> gnu.org
Subject: format-time-string ignores user's preferred locale
Date: Thu, 23 Jan 2020 13:48:16 +1000
Calling function (format-time-string "%x") will output incorrect time
string, ignoring user's preferred locale.

* Steps to reproduce:

1. ensure locale is correct with M-x getenv RET LANG RET
    -> en_AU.UTF-8
2. M-: (format-time-string "%x") RET
    -> "01/23/20"
3. repeat for env LC_TIME

* Expected results:

The format for %x as per the docs:
    %x is the locale’s "preferred" date format.

en_AU locale's "preferred" date format should be DD/MM/YYYY:
"23/01/2020"

i.e. the same as output from shell:
    $ locale
    LANG="en_AU.UTF-8"
    LC_COLLATE="en_AU.UTF-8"
    LC_CTYPE="en_AU.UTF-8"
    LC_MESSAGES="en_AU.UTF-8"
    LC_MONETARY="en_AU.UTF-8"
    LC_NUMERIC="en_AU.UTF-8"
    LC_TIME="en_AU.UTF-8"
    LC_ALL=
    $ date +%x
    23/01/2020

* Actual results:

"01/23/20"

GNU Emacs 27.0.60 (build 1, x86_64-apple-darwin19.2.0, NS appkit-1894.20
Version 10.15.2 (Build 19C57)) of 2020-01-18


[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Alan Third <alan <at> idiocy.org>
Cc: Glenn Morris <rgm <at> gnu.org>, "Paul W. Rankin" <hello <at> paulwrankin.com>,
 39248-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#39248: format-time-string ignores user's preferred locale
Date: Sun, 26 Jan 2020 00:35:31 -0800
On 1/25/20 3:18 AM, Alan Third wrote:
> On Thu, Jan 23, 2020 at 11:35:20PM -0800, Paul Eggert wrote:
>>   #ifdef HAVE_NS
>>     ns_pool = ns_alloc_autorelease_pool ();
>> -#ifdef NS_IMPL_GNUSTEP
>> -  /* GNUstep stupidly resets our locale settings after we made them.  */
>> -  fixup_locale ();
>> -#endif
> 
> Hi Paul, this LGTM, but I’m just curious if you’re sure we don’t need
> that code above any more?

Although I don't use GNUstep and haven't tested the code, as I recall GNUstep 
initializes itself on its first call (which is why the fixup_locale call was 
there, as ns_alloc_autorelease_pool was the first call to GNUstep), and if so 
then we don't need fixup_locale there anymore since we now call fixup_locale 
earlier, just after calling ns_init_locale which calls NSLocale currentlocale 
should cause GNUstep to initialize itself.

If I'm wrong feel free to put that code back in, but in the meantime I installed 
the patch as-is, as Paul R. reports that it works for him.


This bug report was last modified 5 years and 173 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.