Custom locale to use ISO 8601 date format
mail at ozzmosis.com
Sun Jun 7 15:31:35 UTC 2015
On Sun 2015-06-07 10:42:32 UTC-0400, A.J. Kehoe IV (Nanoman) (nanoman at nanoman.ca) wrote:
> >Here in Australia the general population uses the British DD/MM/YY
> >format for representing dates, eg. today is 07/06/15, and the
> >en_AU.UTF-8 locale in FreeBSD 10.1 honours that:
> >lrwxr-xr-x 1 root wheel 22 17 Feb 2011 /usr/share/locale/en_AU.UTF-8/LC_TIME -> ../en_GB.UTF-8/LC_TIME
> >However I wanted programs to use the ISO 8601 YYYY-MM-DD date format
> >(2015-06-07) instead. To do this in Linux, the general method seems to
> >set LC_TIME=en_DK.utf8, but FreeBSD has no locale by that name.
> Thanks for sharing your patch, Andrew! Personally, I wish everybody
> would adopt ISO 8601, or even ISO 2014, which was standardized twelve
> years earlier in the year 1976.
I'd like to see that too, I'm not holding my breath. Maybe after the US
moves to metric... ;-)
I'm not suggesting en_AU.*/LC_TIME be changed system-wide. The patch
just works for me locally and I'm fine with that.
> Canada uses ISO 8601, but this isn't reflected in FreeBSD's en_CA
> locale, so I submitted this patch:
That's encouraging to hear. I think you'll need to provide a
better source than Wikipedia though.
Also, obviously what the standards association has adopted and what's
actually used by the general public can be two different things.
System locales should probably err on the side of what is already
being used. Of course what is being used can also be dictated by the
system locale, so it's a bit chicken-and-egg really.
And all of this assumes the programs you use honour your chosen
locale. Some apps blindly ignore it, and some have their own setting
for the date/time format, with the pros and cons of doing that.
> After somebody commits this patch (or a patch that does something
> similar), you could use en_CA instead of having to manually patch
> every system you maintain.
I could, but I'll be doing the latter since it means I'll always have
complete control over my locale. Plus I only maintain a couple of FreeBSD
systems where locale really matters to me on a daily basis. A once-off
rsync of $HOME/locale/ is no big deal.
More information about the freebsd-questions