Interactive selection of language

This commit is contained in:
Bob Mottram 2015-12-03 15:27:14 +00:00
parent f5979fcd7a
commit f9d31dbdbb
2 changed files with 33 additions and 1 deletions

View File

@ -108,6 +108,7 @@ WIFI_CHANNEL=
CONFIGURATION_FILE=
DH_KEYLENGTH=
MINIMAL_INSTALL="yes"
DEFAULT_LANGUAGE='en_GB.UTF-8'
function show_help {
echo ''
@ -182,6 +183,7 @@ function save_configuration_file {
echo "DDNS_PROVIDER=$DDNS_PROVIDER" >> $CONFIGURATION_FILE
echo "DDNS_USERNAME=$DDNS_USERNAME" >> $CONFIGURATION_FILE
echo "DDNS_PASSWORD=$DDNS_PASSWORD" >> $CONFIGURATION_FILE
echo "DEFAULT_LANGUAGE=$DEFAULT_LANGUAGE" >> $CONFIGURATION_FILE
if [ "$MY_NAME" ]; then
echo "MY_NAME=$MY_NAME" >> $CONFIGURATION_FILE
fi
@ -499,6 +501,35 @@ function interactive_gpg {
done
}
function interactive_select_language {
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Configuration" \
--radiolist $"Select your language:" 12 40 4 \
1 $"English" on \
2 $"French" off \
3 $"German" off \
4 $"Spanish" off 2> $data
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
case $(cat $data) in
1) DEFAULT_LANGUAGE='en_GB.UTF-8';;
2) DEFAULT_LANGUAGE='fr_FR.UTF-8';;
3) DEFAULT_LANGUAGE='de_DE.UTF-8';;
3) DEFAULT_LANGUAGE='es_ES.UTF-8';;
esac
save_configuration_file
update-locale LANG=${DEFAULT_LANGUAGE}
update-locale LANGUAGE=${DEFAULT_LANGUAGE}
update-locale LC_MESSAGES=${DEFAULT_LANGUAGE}
update-locale LC_ALL=${DEFAULT_LANGUAGE}
update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
}
function interactive_configuration {
# create a temporary copy of the configuration file
# which can be used to pre-populate selections
@ -506,6 +537,8 @@ function interactive_configuration {
cp $CONFIGURATION_FILE temp.cfg
fi
interactive_select_language
FREEDNS_MESSAGE=$"Please enter the FreeDNS code for this domain.\n\nThe code can be found by going to https://freedns.afraid.org, selecting 'Dynamic DNS' and then opening 'Wget example'. The code will consist of letters and numbers and be between the ? and = characters."
dialog --title $"Freedombone" --msgbox $"Welcome to the Freedombone interactive installer. Communications freedom is only a short time away.\n\nEnsure that you have your domain and dynamic DNS settings ready.\n\nFor more information please visit $FREEDOMBONE_WEBSITE or send a Bitmessage to $FREEDOMBONE_BITMESSAGE" 15 50

View File

@ -266,7 +266,6 @@ EOF
echo " git stash" >> $rootdir/root/.bashrc
echo " git pull" >> $rootdir/root/.bashrc
echo " make install" >> $rootdir/root/.bashrc
echo " dpkg-reconfigure locales" >> $rootdir/root/.bashrc
if [[ $MINIMAL_INSTALL == "no" ]]; then
echo " ${PROJECT_NAME} menuconfigfull" >> $rootdir/root/.bashrc