[PC-BSD Commits] r4866 - pcbsd/trunk/pc-sysinstall/backend

svn at pcbsd.org svn at pcbsd.org
Wed Nov 4 09:46:20 PST 2009


Author: kris
Date: 2009-11-04 09:46:20 -0800 (Wed, 04 Nov 2009)
New Revision: 4866

Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-localize.sh
Log:

Finished up our localization functions, should work properly now with setting up kde4 



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-localize.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-localize.sh	2009-11-04 17:10:58 UTC (rev 4865)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-localize.sh	2009-11-04 17:46:20 UTC (rev 4866)
@@ -4,24 +4,91 @@
 . ${BACKEND}/functions.sh
 . ${BACKEND}/functions-parse.sh
 
+
+# Function which localizes a FreeBSD install
 localize_freebsd()
 {
 
 };
 
+
+# Function which localizes a PC-BSD install
 localize_pcbsd()
 {
+  #Change the skel files
+  ##########################################################################
+  sed -i.bak "s/Country=us/Country=${COUNTRY}/g" ${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals
 
+  sed -i.bak "s/Language=en_US/Language=${SETLANG}/g" ${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals
+
+  #Change the root files
+  ##########################################################################
+  sed -i.bak "s/Country=C/Country=${COUNTRY}/g" ${FSMNT}/root/.kde4/share/config/kdeglobals
+
+  sed -i.bak "s/Language=en_US/Language=${SETLANG}/g" ${FSMNT}/root/.kde4/share/config/kdeglobals
+
+  #Change KDM Langs
+  ##########################################################################
+  sed -i.bak "s/Language=en_US/Language=${SETKDMLANG}/g" ${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc
+
 };
 
+# Function which sets the keyboard model in kxkbrc
 localize_key_model()
 {
+  MODEL="$1"
+  KXKBRC="${FSMNT}/usr/share/skel/.kde4/share/config/kxkbrc"
+  if [ -e "${KXKBRC}" ]
+  then
+    sed -i.bak "s/Model=pc104/Model=${MODEL}/" ${KXKBRC}
+  fi
 
 };
 
 localize_key_layout()
 {
 
+  KEYLAYOUT="$1"
+
+  # Set the keylayout in rc.conf
+  case ${KEYLAYOUT} in
+    am) KEYLAYOUT_CONSOLE="hy.armscii-8" ;;
+    cz) KEYLAYOUT_CONSOLE="cz.iso2" ;;
+    de) KEYLAYOUT_CONSOLE="german.iso" ;;
+    dk) KEYLAYOUT_CONSOLE="danish.iso" ;;
+    ee) KEYLAYOUT_CONSOLE="estonian.iso" ;;
+    es) KEYLAYOUT_CONSOLE="spanish.iso" ;;
+    fi) KEYLAYOUT_CONSOLE="finnish.iso" ;;
+    is) KEYLAYOUT_CONSOLE="icelandic.iso" ;;
+    jp) KEYLAYOUT_CONSOLE="jp.106" ;;
+    nl) KEYLAYOUT_CONSOLE="dutch.iso.acc" ;;
+    no) KEYLAYOUT_CONSOLE="norwegian.iso" ;;
+    pl) KEYLAYOUT_CONSOLE="pl_PL.ISO8859-2" ;;
+    ru) KEYLAYOUT_CONSOLE="ru.koi8-r" ;;
+    sk) KEYLAYOUT_CONSOLE="sk.iso2" ;;
+    se) KEYLAYOUT_CONSOLE="swedish.iso" ;;
+    tr) KEYLAYOUT_CONSOLE="tr.iso9.q" ;;
+     *)  if [ ! -z "${KEYLAYOUT}" ]
+         then
+           KEYLAYOUT_CONSOLE="${KEYLAYOUT}.iso"
+         fi
+        ;;
+  esac
+
+  if [ ! -z "${KEYLAYOUT_CONSOLE}" ]
+  then
+    echo "keymap=\"${KEYLAYOUT_CONSOLE}\"" >>${FSMNT}/etc/rc.conf
+  fi
+
+  # Now localize any xorg layouts
+
+  
+  KXKBRC="${FSMNT}/usr/share/skel/.kde4/share/config/kxkbrc"
+  if [ -e "${KXKBRC}" ]
+  then
+    sed -i.bak "s/CHANGEME/${KEYLAYOUT},us/g" ${KXKBRC}
+  fi
+
 };
 
 localize_key_variant()
@@ -29,6 +96,121 @@
 
 };
 
+# Function which sets COUNTRY SETLANG and LOCALE based upon $1
+localize_get_codes()
+{ 
+  TARGETLANG="${1}"
+  # Setup the presets for the specific lang
+  case $TARGETLANG in
+   af) COUNTRY="C"
+       SETLANG="af"
+       LOCALE="af_ZA"
+   ar) COUNTRY="C"
+       SETLANG="ar"
+       LOCALE="en_US"
+   az) COUNTRY="C"
+       SETLANG="az"
+       LOCALE="en_US"
+   ca) COUNTRY="es"
+       SETLANG="es:ca"
+       LOCALE="ca_ES"
+   be) COUNTRY="be"
+       SETLANG="be"
+       LOCALE="be_BY" ;;
+   bn) COUNTRY="bn"
+       SETLANG="bn"
+       LOCALE="en_US"
+   bg) COUNTRY="bg"
+       SETLANG="bg"
+       LOCALE="bg_BG"
+   da) COUNTRY="dk"
+       SETLANG="da"
+       LOCALE="da_DK"
+   de) COUNTRY="de"
+       SETLANG="de"
+       LOCALE="de_DE"
+   en_GB) COUNTRY="gb"
+       SETLANG="en_GB:cy"
+       LOCALE="en_GB"
+   el) COUNTRY="gr"
+       SETLANG="el:gr"
+       LOCALE="el_GR"
+   es) COUNTRY="es"
+       SETLANG="es"
+       LOCALE="es_ES"
+   es_LA) COUNTRY="us"
+          SETLANG="es:en_US"
+          LOCALE="es_ES"
+   et) COUNTRY="ee"
+       SETLANG="et"
+       LOCALE="et_EE"
+   fr) COUNTRY="fr"
+       SETLANG="fr"
+       LOCALE="fr_FR"
+   he) COUNTRY="il"
+       SETLANG="he:ar"
+       LOCALE="he_IL"
+   hr) COUNTRY="hr"
+       SETLANG="hr"
+       LOCALE="hr_HR"
+   hu) COUNTRY="hu"
+       SETLANG="hu"
+       LOCALE="hu_HU"
+   it) COUNTRY="it"
+       SETLANG="it"
+       LOCALE="it_IT"
+   ja) COUNTRY="jp"
+       SETLANG="ja"
+       LOCALE="ja_JP"
+   ko) COUNTRY="kr"
+       SETLANG="ko"
+       LOCALE="ko_KR"
+   nl) COUNTRY="nl"
+       SETLANG="nl"
+       LOCALE="nl_NL"
+   nn) COUNTRY="no"
+       SETLANG="nn"
+       LOCALE="en_US"
+   pl) COUNTRY="pl"
+       SETLANG="pl"
+       LOCALE="pl_PL"
+   pt) COUNTRY="pt"
+       SETLANG="pt"
+       LOCALE="pt_PT"
+   pt_BR) COUNTRY="br"
+          SETLANG="pt_BR"
+          LOCALE="pt_BR"
+   ru) COUNTRY="ru"
+       SETLANG="ru"
+       LOCALE="ru_RU"
+   sk) COUNTRY="sk"
+       SETLANG="sk"
+       LOCALE="sk_SK"
+   sv) COUNTRY="se"
+       SETLANG="sv"
+       LOCALE="sv_SE"
+   uk) COUNTRY="ua"
+       SETLANG="uk"
+       LOCALE="uk_UA"
+   vi) COUNTRY="vn"
+       SETLANG="vi"
+       LOCALE="en_US"
+   zh_CN) COUNTRY="cn"
+          SETLANG="zh_CN"
+          LOCALE="zh_CN"
+   zh_TW) COUNTRY="tw"
+          SETLANG="zh_TW"
+          LOCALE="zh_TW"
+   *) COUNTRY="C"
+      SETLANG="${LANG}"
+      LOCALE="en_US"
+  esac
+
+ export COUNTRY SETLANG LOCALE
+
+};
+
+
 # Starts checking for localization directives
 run_localize()
 {
@@ -38,6 +220,10 @@
     echo $line | grep "^localizeLang=" >/dev/null 2>/dev/null
     if [ "$?" = "0" ]
     then
+
+      # Set our country / lang / locale variables
+      localize_get_codes ${VAL}
+
       get_value_from_string "$line"
       # If we are doing PC-BSD install, localize it as well as FreeBSD base
       if [ "${INSTALLTYPE}" != "FreeBSD" ]



More information about the Commits mailing list