[arch-releng] LOCALE from TIMEZONE

Dieter Plaetinck dieter at plaetinck.be
Mon Apr 13 07:37:03 EDT 2009


On Mon, 13 Apr 2009 20:59:18 +1000
Jud <jud at judfilm.net> wrote:

> This was just an random idea I had, quickly fleshed out, maybe it
> could prove useful. Comments and suggestions welcome.
> 
> #!/bin/bash
> # Proof of Concept
> #
> # /src/core/libs/lib-software.sh target_configure_initial_locale()
> #
> 
> # Ref: http://twiki.org/cgi-bin/xtra/tzdatepick.html
> 
> # Dummy/Test Data
> #timez="Australia/Brisbane"
> #timez="Pacific/Auckland"
> #timez="Europe/Berlin"
> timez="Europe/London"
> locle="en_US.utf8"
> 
> # From the user set TIMEZONE (Set Clock) workout the LOCALE
> # Would provide a "good guess" for installation before System
> Configuration
> # Would assume person installing is from the selected region
> # Only for non en_US locale/languages?
> 
> # ToDo:
> # How to make this into a function?
> # What about users who use km or set via Grub option?
> # Is there any easy way?
> # How to comment en_US?
> 
> # Continents - very rough only Australia would work well
> # What would be the most common for the region?
> [[ $timez =~ "Africa" ]] && locle=
> [[ $timez =~ "America" ]] && locle="en_US.utf8"
> [[ $timez =~ "Antarctica" ]] && locle="en_AU.utf8"
> [[ $timez =~ "Artic" ]] && locle="en_US.utf8"
> [[ $timez =~ "Asia" ]] && locle=
> [[ $timez =~ "Atlantic" ]] && locle="en_US.utf8"
> [[ $timez =~ "Australia" ]] && locle="en_AU.utf8"
> [[ $timez =~ "Europe" ]] && locle=
> [[ $timez =~ "Indian" ]] && locle=
> [[ $timez =~ "Mideast" ]] && locle=
> [[ $timez =~ "Pacific" ]] && locle=
> 
> # Countries/Cities - very large list - sample only - send in your
> rules! # What would be the most common for the country/city?
> [[ $timez =~ "Berlin" ]] && locle="de_DE.utf8"
> [[ $timez =~ "Auckland" ]] && locle="en_NZ.utf8"
> [[ $timez =~ "London" ]] && locle="en_GB.utf8"
> 
> 
> echo $locle
> 
> # Real version would set LOCALE in /etc/rc.conf
> 
> # End of File

would we have to maintain the timezone-to-locale maps ourselves?
if so, it may be too much effort for the small benefit.
Also, I'm not sure but I think many people prefer to use en_US.utf8
anyway, no matter where they are from.
Or at least, that's what I do, or am I doing it wrong/missing something?

PS: km is now just a script that calls "aif -p partial-keymap". see
http://bugs.archlinux.org/task/13597

Dieter


More information about the arch-releng mailing list