[arch-releng] LOCALE from TIMEZONE

Jud jud at judfilm.net
Mon Apr 13 06:59:18 EDT 2009


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


More information about the arch-releng mailing list