slitaz-tools view tinyutils/tazkeymap @ rev 625

Gettextize setmixer and make pot
author Christophe Lincoln <pankso@slitaz.org>
date Tue Jun 14 22:47:24 2011 +0200 (2011-06-14)
parents cd1c6f4ddeb3
children 41b3ae3aff8b
line source
1 #!/bin/sh
2 #
3 # Tazkeymap - SliTaz GNU/Linux keymap config using loadkeys and dialog boxes.
4 # Configuration file is : /etc/keymap.conf
5 #
6 # (C) SliTaz GNU/Linux - 2011 <pankso@slitaz.org> - GNU gpl.
7 #
8 : ${DIALOG=dialog}
10 # Internationalization
11 . /usr/bin/gettext.sh
12 TEXTDOMAIN='slitaz-tools'
13 export TEXTDOMAIN
15 # Check if user is root.
16 if test $(id -u) != 0; then
17 gettext "You must be root to run:"; echo " $(basename $0)"
18 gettext "Type su and root password to become super-user"; echo
19 exit 1
20 fi
22 # Get current keymap if it exists.
23 if [ -s /etc/keymap.conf ]; then
24 CUR=`cat /etc/keymap.conf`
25 else
26 CUR="none"
27 fi
29 # Load the selected kmap file from /usr/share/kbd/keymaps or Busybox kmaps.
30 load_keymap() {
31 if [ -x /bin/loadkeys ]; then
32 loadkeys $kmap
33 else
34 loadkmap < /usr/share/kmap/$kmap.kmap
35 fi
36 }
38 case "$1" in
39 config)
40 # Used to configure keymap from cmdline or scripts
41 kmap=$2
42 echo "$kmap" > /etc/keymap.conf
43 load_keymap ;;
44 init)
45 # Used to configure keymap boot scripts, keymap us then loaded by
46 # the script /etc/init.d/i18n.sh
47 kmap=$2
48 echo "$kmap" > /etc/keymap.conf ;;
49 *)
50 # Default to text mode dialog.
51 exec 3>&1
52 value=`$DIALOG --clear \
53 --title " $(gettext "SliTaz keymap configuration") " \
54 --menu "" 15 70 5 \
55 "us" "USA" \
56 "fr_CH-latin1" "Suisse Romande" \
57 "fr-latin1" "France" \
58 "be-latin1" "Belgique" \
59 "br-abnt2" "Brazil" \
60 "cf" "Canada/Quebec" \
61 "croat" "Croat" \
62 "cz-lat2" "Czech" \
63 "de_CH-latin1" "Schweizer Deutsch" \
64 "de-latin1" "Deutchland" \
65 "dk-latin1" "Danemark" \
66 "dvorak" "Dvorak" \
67 "dvorak-r" "Dvorak (right-hand)" \
68 "dvorak-l" "Dvorak (left-hand)" \
69 "es" "Spain/Mexico" \
70 "fi-latin1" "Finland" \
71 "hu" "Hungria" \
72 "it" "Italia" \
73 "is-latin1" "Island" \
74 "jp106" "Japan" \
75 "nl2" "Netherlands" \
76 "no-latin1" "Norway" \
77 "pl2" "Poland" \
78 "pt-latin1" "Portugal" \
79 "ru" "Russia" \
80 "se-lat6" "Sweden" \
81 "sg-latin1" "Singapore " \
82 "trq" "Turkey" \
83 "uk" "United Kingdom" \
84 "us-acentos" "USA Acentos" \
85 2>&1 1>&3`
86 retval=$?
87 exec 3>&-
88 case $retval in
89 0) continue ;;
90 1|255) exit 0 ;;
91 esac
92 # If it's a reconfiguration give an info message.
93 if [ -s /etc/keymap.conf ]; then
94 msg=$(gettext "\
95 Please logout of your current session and login again to use new keyboard.")
96 $DIALOG --clear \
97 --title " Information " \
98 --msgbox "$msg" 16 70
99 fi
100 kmap=$value
101 echo "$kmap" > /etc/keymap.conf
102 load_keymap ;;
103 esac
105 exit 0