[PLUG] Modifying LC_TIME

Rich Shepard rshepard at appl-ecosys.com
Mon Sep 25 13:19:06 UTC 2006


On Mon, 25 Sep 2006, Daniel Hedlund wrote:

> 19971201 -> 1997/12/01 (YYYY/MM/DD) = Monday
> 19971130 -> 1997/11/30 (YYYY/MM/DD) = Sunday

Daniel,

   Exactly.

> This problem that you describe appears to have been widely reported as a
> bug in GNU C library's locale.
> http://sourceware.org/bugzilla/show_bug.cgi?id=2371

   A-ha! I've experienced it only in gtk+2's calendar.

> I'm not sure what version of the glibc library you're running,

 	2.3.5

> ... but you're probably stuck with one of the versions that has the bug. 
> The version I'm using, 2.4.11 doesn't seem to be affected by this problem
> and my week-1stday entry appears as 19971130...so the problem has been
> fixed at some point.

   Well, fixed for those of us here in the US, anyway. :-) The fellow in GB
who wrote the gentoo fix wanted to go from a starting day of Sunday to that
of Monday.

> I only see the following options for you:
> 1. upgrade glibc (ugly and probably not worth it!)

   Not until Slackware-11.0 comes out ... Real Soon Now.

> 2. change to a different locale for the LC_TIME variable, such as
> en_US.UTF-8 and see if that provides a different value for week-1stday. 
> The following code automates testing every single locale on the system
> that matches your desired LC_TIME settings:
> #!/bin/bash
> # finds other locales that match the desired LC_TIME settings
> export LC_TIME="en_US"
> locale -k LC_TIME | sed s/19971201/19971130/ > locale.old
> for i in `locale -a`; do
>   export LC_TIME="$i"
>   locale -k LC_TIME > locale.new
>   (diff --brief locale.old locale.new > /dev/null) \
>     && echo "match found...$i"
> done

   Oooh, nice!

> 3. use localedef. I wrote a bash script specifically to do this for you!
> Well, for anyone else who comes across the bug in the future and for
> myself. I wanted to be able to change the starting day of the week for
> the en_AU locale to be on a Monday (which for some reason it isn't). I
> can imagine that several months in the future when I reinstall/upgrade my
> distro that I'll forget to copy over the new locales (or they won't work),
> and I'll have forgotten how to fix things again. I've tested the script
> on my system and it seemed to work. There is nothing destructive and it
> can be run as non-root. The defaults on the configuration variables are
> already set for your bug; just run the script and follow the "further
> instructions". Have a look here:
> http://projects.digitree.org/miscellaneous/wiki/locale_week_fix

   Thank you. That's teriffic and exceptionally helpful for a lot of folks.
You're right that a system upgrade will overwrite the changes, so it's wise
to keep the script handy.

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.(TM)    |            Accelerator
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863



More information about the PLUG mailing list