slitaz-tools rev 147

tazlocale: KISS gen locale list with 'locale -a'
author Christophe Lincoln <pankso@slitaz.org>
date Thu Apr 17 21:48:40 2008 +0200 (2008-04-17)
parents 9e9f25d6d0cd
children 5a02d8675c99
files tinyutils/tazlocale
line diff
     1.1 --- a/tinyutils/tazlocale	Thu Apr 17 19:10:53 2008 +0200
     1.2 +++ b/tinyutils/tazlocale	Thu Apr 17 21:48:40 2008 +0200
     1.3 @@ -35,7 +35,8 @@
     1.4  	--title " SliTaz locale configuration " \
     1.5  	--menu \
     1.6  "Select your language - Séléctionnez votre langue" 15 70 5 \
     1.7 -$(cd /usr/share/i18n/locales/; ls -1 [a-z][a-z]_* | awk '{ printf "%s Locale\n",$1,$2 }') \
     1.8 +"en" "Locale" \
     1.9 +$(locale -a | grep ^[a-z] | awk '{ printf "%s Locale\n",$1,$2 }') \
    1.10  2>&1 1>&3`
    1.11  retval=$?
    1.12  exec 3>&-
    1.13 @@ -55,37 +56,15 @@
    1.14  	fi ;;
    1.15  esac
    1.16  
    1.17 -LOCALE=$value
    1.18 -
    1.19 -# Set charmaps, used files are in: /usr/share/i18n/charmaps
    1.20 -#
    1.21 -case $LOCALE in
    1.22 -	# ISO-8859-1
    1.23 -	de_*|en_*|es_*|fr_*|it_IT)
    1.24 -		CHARMAP='ISO-8859-1' ;;
    1.25 -	# ISO-8859-2
    1.26 -	cs_*)
    1.27 -		CHARMAP='ISO-8859-2' ;;
    1.28 -	ru_*)
    1.29 -		CHARMAP='KOI8-RU' ;;
    1.30 - 	*)
    1.31 -		echo "Locale: $value specifications not yet implemeted... Sorry."
    1.32 -		CHARMAP='ISO-8859-1'
    1.33 -		LOCALE='en_US' ;;
    1.34 -esac
    1.35 +# Default: C = English
    1.36 +if [ "$value" = "en" ]; then
    1.37 +	value='C'
    1.38 +fi
    1.39  
    1.40  # System configuration
    1.41 -echo -n "Setting system locale to: $value "
    1.42 -localedef -i $LOCALE -c -f ISO-8859-1 $fs/usr/lib/locale/$LOCALE
    1.43 -status
    1.44 -echo -n "Creating configuration file: /etc/locale.conf"
    1.45 -echo "LANG=$LOCALE" > /etc/locale.conf
    1.46 -echo "LC_ALL=$LOCALE" >> /etc/locale.conf
    1.47 -status
    1.48 +echo "LANG=$value" > /etc/locale.conf
    1.49 +echo "LC_ALL=$value" >> /etc/locale.conf
    1.50  
    1.51 -if [ -f "/etc/locale.conf" ]; then
    1.52 -	. /etc/locale.conf
    1.53 -	export LANG LC_ALL
    1.54 -fi
    1.55 +. /etc/locale.conf && export LANG LC_ALL
    1.56  
    1.57  exit 0