瀏覽代碼

Interactive selection of language

Bob Mottram 9 年之前
父節點
當前提交
f9d31dbdbb
共有 2 個文件被更改,包括 33 次插入1 次删除
  1. 33
    0
      src/freedombone-config
  2. 0
    1
      src/freedombone-image-customise

+ 33
- 0
src/freedombone-config 查看文件

108
 CONFIGURATION_FILE=
108
 CONFIGURATION_FILE=
109
 DH_KEYLENGTH=
109
 DH_KEYLENGTH=
110
 MINIMAL_INSTALL="yes"
110
 MINIMAL_INSTALL="yes"
111
+DEFAULT_LANGUAGE='en_GB.UTF-8'
111
 
112
 
112
 function show_help {
113
 function show_help {
113
     echo ''
114
     echo ''
182
     echo "DDNS_PROVIDER=$DDNS_PROVIDER" >> $CONFIGURATION_FILE
183
     echo "DDNS_PROVIDER=$DDNS_PROVIDER" >> $CONFIGURATION_FILE
183
     echo "DDNS_USERNAME=$DDNS_USERNAME" >> $CONFIGURATION_FILE
184
     echo "DDNS_USERNAME=$DDNS_USERNAME" >> $CONFIGURATION_FILE
184
     echo "DDNS_PASSWORD=$DDNS_PASSWORD" >> $CONFIGURATION_FILE
185
     echo "DDNS_PASSWORD=$DDNS_PASSWORD" >> $CONFIGURATION_FILE
186
+    echo "DEFAULT_LANGUAGE=$DEFAULT_LANGUAGE" >> $CONFIGURATION_FILE
185
     if [ "$MY_NAME" ]; then
187
     if [ "$MY_NAME" ]; then
186
         echo "MY_NAME=$MY_NAME" >> $CONFIGURATION_FILE
188
         echo "MY_NAME=$MY_NAME" >> $CONFIGURATION_FILE
187
     fi
189
     fi
499
     done
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
 function interactive_configuration {
533
 function interactive_configuration {
503
     # create a temporary copy of the configuration file
534
     # create a temporary copy of the configuration file
504
     # which can be used to pre-populate selections
535
     # which can be used to pre-populate selections
506
         cp $CONFIGURATION_FILE temp.cfg
537
         cp $CONFIGURATION_FILE temp.cfg
507
     fi
538
     fi
508
 
539
 
540
+    interactive_select_language
541
+
509
     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."
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
     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
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 查看文件

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