From 10067eb5b079e19ce55192214b2193edbf39c89e Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 5 Apr 2014 18:22:14 +0200 Subject: [PATCH] installer.kmdr: fixes for language and locale settings; drop support; drop support for /etc/sysconfig/{i18n,keyboard} --- installer/installer.kmdr | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/installer/installer.kmdr b/installer/installer.kmdr index 4448134..5e76ab7 100755 --- a/installer/installer.kmdr +++ b/installer/installer.kmdr @@ -953,8 +953,7 @@ if [ -r ~/.kde4/share/config/kdeglobals ]; then *) LANGUAGE="${Language}" ;; esac LANGUAGE=${LANGUAGE:0:5}.UTF-8 - sed -i "s|LANG=.*|LANG=$LANGUAGE|" /etc/sysconfig/i18n - sed -i "s|LANG=.*|LANG=$LANGUAGE|" /etc/locale.conf + sudo sed -i "s|LANG=.*|LANG=$LANGUAGE|" /etc/locale.conf fi fi @execEnd @@ -977,8 +976,7 @@ fi - . /etc/sysconfig/i18n -LANGUAGE="$LANG" + LANGUAGE="$LANG" if [ -r ~/.kde4/share/config/kdeglobals ]; then eval `grep -i Country ~/.kde4/share/config/kdeglobals` # find country definition in selected language @@ -1000,6 +998,7 @@ fi case ${LANGUAGE:0:5} in en_*) LANGUAGE="English (${LANGUAGE:3:2})" ;; es_*) LANGUAGE="Español" ;; + fr_*) LANGUAGE="Français" ;; it_IT) LANGUAGE="Italiano" ;; it_CH) LANGUAGE="Italiano (CH)" ;; *) LANGUAGE="${LANGUAGE:0:2}" ;; @@ -1139,17 +1138,14 @@ dcop @dcopid KommanderIf setText countrylabel $"$COUNTRY" LAYOUT_CURR="@kblayout_box.item(@kblayout_box.currentItem)" MODEL_CURR="@kbgeometry_box.item(@kbgeometry_box.currentItem)" -LAYOUT=`awk '/! layout/,/$^/' /usr/share/X11/xkb/rules/base.lst | grep "$LAYOUT_CURR" | awk '{print $1}'` -MODEL=`awk '/! model/,/$^/' /usr/share/X11/xkb/rules/base.lst | grep "$MODEL_CURR" | awk '{print $1}'` +LAYOUT=`awk '/! layout/,/$^/' /usr/share/X11/xkb/rules/base.lst | grep " $LAYOUT_CURR$" | awk '{print $1}'` +MODEL=`awk '/! model/,/$^/' /usr/share/X11/xkb/rules/base.lst | grep " $MODEL_CURR$" | awk '{print $1}'` setxkbmap -layout $LAYOUT -model $MODEL -sed -i "s|\(KEYMAP=\).*|\1$LAYOUT.map|" /etc/sysconfig/keyboard -sed -i "s|\(XKB_LAYOUT=\).*|\1$LAYOUT|" /etc/sysconfig/keyboard -sed -i "s|\(XKB_MODEL=\).*|\1$MODEL|" /etc/sysconfig/keyboard -sed -i "s|\(\"XkbLayout\"\).*|\1 \"$LAYOUT\"|" /etc/X11/xorg.conf -sed -i "s|\(\"XkbModel\"\).*|\1 \"$MODEL\"|" /etc/X11/xorg.conf -sed -i "s|\(\"XkbLayout\"\).*|\1 \"$LAYOUT\"|" /etc/X11/xorg.conf.d/10-keyboard.conf -sed -i "s|\(\"XkbModel\"\).*|\1 \"$MODEL\"|" /etc/X11/xorg.conf.d/10-keyboard.conf -sed -i "s|\(KEYMAP=\).*|\1$LAYOUT|" /etc/vconsole.conf +sudo sed -i "s|\(\"XkbLayout\"\).*|\1 \"$LAYOUT\"|" /etc/X11/xorg.conf +sudo sed -i "s|\(\"XkbModel\"\).*|\1 \"$MODEL\"|" /etc/X11/xorg.conf +sudo sed -i "s|\(\"XkbLayout\"\).*|\1 \"$LAYOUT\"|" /etc/X11/xorg.conf.d/10-keyboard.conf +sudo sed -i "s|\(\"XkbModel\"\).*|\1 \"$MODEL\"|" /etc/X11/xorg.conf.d/10-keyboard.conf +sudo sed -i "s|\(KEYMAP=\).*|\1$LAYOUT|" /etc/vconsole.conf @@ -1170,12 +1166,12 @@ sed -i "s|\(KEYMAP=\).*|\1$LAYOUT|" /etc/vconsole.conf @testEdit.setSelection(@testEdit.text) dcop @dcopid KommanderIf setBusyCursor true -. /etc/sysconfig/keyboard if [ ! "$XKB_LAYOUT" ]; then eval `grep "^LayoutList=" ~/.kde4/share/config/kxkbrc` [ "$LayoutList" ] && \ XKB_LAYOUT="${LayoutList/,*/}" || \ - XKB_LAYOUT="us" + XKB_LAYOUT=`setxkbmap -print | awk -F"+" '/xkb_symbols/ { print $2}'` + [ "$XKB_LAYOUT" ] || XKB_LAYOUT="us" fi awk '/! layout/,/$^/' /usr/share/X11/xkb/rules/base.lst | sort -k2 | \ while read id desc; do @@ -1185,6 +1181,13 @@ while read id desc; do fi done +if [ ! "$XKB_MODEL" ]; then + eval `grep "^Model=" ~/.kde4/share/config/kxkbrc` + [ "$Model" ] && \ + XKB_MODEL="${Model/,*/}" || \ + XKB_MODEL=`setxkbmap -print | grep xkb_geometry | sed "s|.*(\(.*\)).*|\1|"` + [ "$XKB_MODEL" ] || XKB_MODEL="pc105" +fi awk '/! model/,/$^/' /usr/share/X11/xkb/rules/base.lst | sort -k2 | \ while read id desc; do if [ "$id" != "!" -a "$id" != "" ]; then