slitaz-tools rev 429

tazctrlbox: Add language setting
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 16 21:53:30 2010 +0100 (2010-02-16)
parents d7ae09d1134f
children 52c53e5e0d5d
files tinyutils/tazctrlbox
line diff
     1.1 --- a/tinyutils/tazctrlbox	Sun Feb 14 23:34:35 2010 +0100
     1.2 +++ b/tinyutils/tazctrlbox	Tue Feb 16 21:53:30 2010 +0100
     1.3 @@ -171,6 +171,24 @@
     1.4  	gtkdialog --center --program=ADD_USER_DIALOG >/dev/null	
     1.5  }
     1.6  
     1.7 +# i18n functions
     1.8 +list_locales()
     1.9 +{
    1.10 +	cd /usr/share/i18n/locales
    1.11 +	for locale in `ls -1 [a-z][a-z]_[A-Z][A-Z]`
    1.12 +	do
    1.13 +		echo "preferences-desktop-locale | $locale | UTF-8"
    1.14 +	done
    1.15 +}
    1.16 +gen_utf8_locale()
    1.17 +{
    1.18 +	rm -rf /usr/lib/locale/$LANGUAGE
    1.19 +	localedef -i $LANGUAGE -c -f UTF-8 /usr/lib/locale/$LANGUAGE
    1.20 +	# System configuration
    1.21 +	echo "LANG=$LANGUAGE" > /etc/locale.conf
    1.22 +	echo "LC_ALL=$LANGUAGE" >> /etc/locale.conf
    1.23 +}
    1.24 +
    1.25  # Main dialog with notebook.
    1.26  #
    1.27  export MAIN_DIALOG='
    1.28 @@ -186,58 +204,8 @@
    1.29  		</pixmap>
    1.30  	</hbox>
    1.31  
    1.32 -	<notebook labels="Time|Boot loader|Initialization|Login manager|Users">
    1.33 +	<notebook labels="Boot loader|Initialization|Login manager|Time|Language|Users">'
    1.34  	
    1.35 -	<vbox>
    1.36 -		<frame Date and time>
    1.37 -			<hbox>
    1.38 -				<text wrap="false">
    1.39 -					<label>"System time:   "</label>
    1.40 -				</text>
    1.41 -				<entry editable="false">
    1.42 -					<input>LC_ALL=C date</input>
    1.43 -					<variable>DATE</variable>
    1.44 -				</entry>
    1.45 -				<button>
    1.46 -					<label>Sync online</label>
    1.47 -					<input file icon="reload"></input>
    1.48 -					<action>rdate -s tick.greyware.com</action>
    1.49 -					<action>refresh:DATE</action>
    1.50 -					<action>refresh:HWTIME</action>
    1.51 -				</button>
    1.52 -			</hbox>
    1.53 -			<hbox>
    1.54 -				<text wrap="false">
    1.55 -					<label>"Hardware time:"</label>
    1.56 -				</text>
    1.57 -				<entry editable="false">
    1.58 -					<input>LC_ALL=C hwclock</input>
    1.59 -					<variable>HWTIME</variable>
    1.60 -				</entry>
    1.61 -				<button>
    1.62 -					<label>Set from system</label>
    1.63 -					<input file icon="reload"></input>
    1.64 -					<action>hwclock -w -u</action>
    1.65 -					<action>refresh:HWTIME</action>
    1.66 -					<action>refresh:DATE</action>
    1.67 -				</button>
    1.68 -			</hbox>
    1.69 -			<hbox>
    1.70 -				<text wrap="true">
    1.71 -					<label>"Timezone:       "</label>
    1.72 -				</text>
    1.73 -				<entry>
    1.74 -					<input>cat /etc/TZ</input>
    1.75 -					<variable>NEW_TZ</variable>
    1.76 -				</entry>
    1.77 -				<button>
    1.78 -					<label>Change</label>
    1.79 -					<input file icon="forward"></input>
    1.80 -					<action>echo "$NEW_TZ" > /etc/TZ</action>
    1.81 -				</button>
    1.82 -			</hbox>
    1.83 -		</frame>
    1.84 -	</vbox>'
    1.85  # GRUB
    1.86  MAIN_DIALOG=${MAIN_DIALOG}"
    1.87  	<vbox>
    1.88 @@ -389,11 +357,6 @@
    1.89  				</button>
    1.90  			</hbox>
    1.91  			<hbox>
    1.92 -				<button>
    1.93 -					<label>Resize screen</label>
    1.94 -					<input file icon="view-fullscreen"></input>
    1.95 -					<action>tazx</action>
    1.96 -				</button>
    1.97  				<text wrap="false">
    1.98  					<label>"Theme:"</label>
    1.99  				</text>
   1.100 @@ -433,6 +396,81 @@
   1.101  			</hbox>
   1.102  		</frame>
   1.103  	</vbox>'
   1.104 +# Time setting.
   1.105 +MAIN_DIALOG=${MAIN_DIALOG}'	
   1.106 +	<vbox>
   1.107 +		<frame Date and time>
   1.108 +			<hbox>
   1.109 +				<text wrap="false">
   1.110 +					<label>"System time:   "</label>
   1.111 +				</text>
   1.112 +				<entry editable="false">
   1.113 +					<input>LC_ALL=C date</input>
   1.114 +					<variable>DATE</variable>
   1.115 +				</entry>
   1.116 +				<button>
   1.117 +					<label>Sync online</label>
   1.118 +					<input file icon="reload"></input>
   1.119 +					<action>rdate -s tick.greyware.com</action>
   1.120 +					<action>refresh:DATE</action>
   1.121 +					<action>refresh:HWTIME</action>
   1.122 +				</button>
   1.123 +			</hbox>
   1.124 +			<hbox>
   1.125 +				<text wrap="false">
   1.126 +					<label>"Hardware time:"</label>
   1.127 +				</text>
   1.128 +				<entry editable="false">
   1.129 +					<input>LC_ALL=C hwclock</input>
   1.130 +					<variable>HWTIME</variable>
   1.131 +				</entry>
   1.132 +				<button>
   1.133 +					<label>Set from system</label>
   1.134 +					<input file icon="reload"></input>
   1.135 +					<action>hwclock -w -u</action>
   1.136 +					<action>refresh:HWTIME</action>
   1.137 +					<action>refresh:DATE</action>
   1.138 +				</button>
   1.139 +			</hbox>
   1.140 +			<hbox>
   1.141 +				<text wrap="true">
   1.142 +					<label>"Timezone:       "</label>
   1.143 +				</text>
   1.144 +				<entry>
   1.145 +					<input>cat /etc/TZ</input>
   1.146 +					<variable>NEW_TZ</variable>
   1.147 +				</entry>
   1.148 +				<button>
   1.149 +					<label>Change</label>
   1.150 +					<input file icon="forward"></input>
   1.151 +					<action>echo "$NEW_TZ" > /etc/TZ</action>
   1.152 +				</button>
   1.153 +			</hbox>
   1.154 +		</frame>
   1.155 +	</vbox>'
   1.156 +# Language setting.
   1.157 +MAIN_DIALOG=${MAIN_DIALOG}"
   1.158 +	<vbox>
   1.159 +		<tree>
   1.160 +			<width>600</width><height>210</height>
   1.161 +			<variable>LANGUAGE</variable>
   1.162 +			<label>Language|Charmap</label>
   1.163 +			<input icon_column=\"0\">$0 list_locales</input>
   1.164 +			<action>$0 gen_utf8_locale</action>
   1.165 +		</tree>
   1.166 +		<hbox>
   1.167 +		<text width-chars=\"60\">
   1.168 +			<label>
   1.169 +\"To change system language you can double-click on the locale name.\"
   1.170 +			</label>
   1.171 +		</text>
   1.172 +		<button>
   1.173 +			<label>Keymap</label>
   1.174 +			<input file icon=\"input-keyboard\"></input>
   1.175 +			<action>tazkeymap &</action>
   1.176 +		</button>
   1.177 +	</hbox>
   1.178 +	</vbox>"
   1.179  # Display users list throught get_users.
   1.180  MAIN_DIALOG=${MAIN_DIALOG}"
   1.181  	<vbox>
   1.182 @@ -497,8 +535,7 @@
   1.183  
   1.184  </vbox>
   1.185  
   1.186 -</window>
   1.187 -'
   1.188 +</window>'
   1.189  
   1.190  # Script can be called with an arg to exec a function.
   1.191  if [ -n "$1" ]; then