From f9d31dbdbba7895162fafdb8be6da0184195f2e0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 3 Dec 2015 15:27:14 +0000 Subject: [PATCH] Interactive selection of language --- src/freedombone-config | 33 +++++++++++++++++++++++++++++++++ src/freedombone-image-customise | 1 - 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/freedombone-config b/src/freedombone-config index 88a74ab3..37d3d7ee 100755 --- a/src/freedombone-config +++ b/src/freedombone-config @@ -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 diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 94c3c2e5..a1bdf69d 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -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