Selaa lähdekoodia

Interactive selection of language

Bob Mottram 9 vuotta sitten
vanhempi
commit
f9d31dbdbb
2 muutettua tiedostoa jossa 33 lisäystä ja 1 poistoa
  1. 33
    0
      src/freedombone-config
  2. 0
    1
      src/freedombone-image-customise

+ 33
- 0
src/freedombone-config Näytä tiedosto

@@ -108,6 +108,7 @@ WIFI_CHANNEL=
108 108
 CONFIGURATION_FILE=
109 109
 DH_KEYLENGTH=
110 110
 MINIMAL_INSTALL="yes"
111
+DEFAULT_LANGUAGE='en_GB.UTF-8'
111 112
 
112 113
 function show_help {
113 114
     echo ''
@@ -182,6 +183,7 @@ function save_configuration_file {
182 183
     echo "DDNS_PROVIDER=$DDNS_PROVIDER" >> $CONFIGURATION_FILE
183 184
     echo "DDNS_USERNAME=$DDNS_USERNAME" >> $CONFIGURATION_FILE
184 185
     echo "DDNS_PASSWORD=$DDNS_PASSWORD" >> $CONFIGURATION_FILE
186
+    echo "DEFAULT_LANGUAGE=$DEFAULT_LANGUAGE" >> $CONFIGURATION_FILE
185 187
     if [ "$MY_NAME" ]; then
186 188
         echo "MY_NAME=$MY_NAME" >> $CONFIGURATION_FILE
187 189
     fi
@@ -499,6 +501,35 @@ function interactive_gpg {
499 501
     done
500 502
 }
501 503
 
504
+function interactive_select_language {
505
+    data=$(tempfile 2>/dev/null)
506
+    trap "rm -f $data" 0 1 2 5 15
507
+    dialog --backtitle $"Freedombone Configuration" \
508
+           --radiolist $"Select your language:" 12 40 4 \
509
+           1 $"English" on \
510
+           2 $"French" off \
511
+           3 $"German" off \
512
+           4 $"Spanish" off 2> $data
513
+    sel=$?
514
+    case $sel in
515
+        1) exit 1;;
516
+        255) exit 1;;
517
+    esac
518
+    case $(cat $data) in
519
+        1) DEFAULT_LANGUAGE='en_GB.UTF-8';;
520
+        2) DEFAULT_LANGUAGE='fr_FR.UTF-8';;
521
+        3) DEFAULT_LANGUAGE='de_DE.UTF-8';;
522
+        3) DEFAULT_LANGUAGE='es_ES.UTF-8';;
523
+    esac
524
+    save_configuration_file
525
+
526
+    update-locale LANG=${DEFAULT_LANGUAGE}
527
+    update-locale LANGUAGE=${DEFAULT_LANGUAGE}
528
+    update-locale LC_MESSAGES=${DEFAULT_LANGUAGE}
529
+    update-locale LC_ALL=${DEFAULT_LANGUAGE}
530
+    update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
531
+}
532
+
502 533
 function interactive_configuration {
503 534
     # create a temporary copy of the configuration file
504 535
     # which can be used to pre-populate selections
@@ -506,6 +537,8 @@ function interactive_configuration {
506 537
         cp $CONFIGURATION_FILE temp.cfg
507 538
     fi
508 539
 
540
+    interactive_select_language
541
+
509 542
     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."
510 543
 
511 544
     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

+ 0
- 1
src/freedombone-image-customise Näytä tiedosto

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