source  $SECTION_DIRECTORY/KDE_CONFIGURE  &&

local CFG=$SPELL_CONFIG

get_kdelanguages()  {
  local  i  LANGUAGE  LANGUAGES  &&
    rm  -f  $CFG                                                   &&
    touch  $CFG                                                    &&
    LANGUAGES=`cat $SCRIPT_DIRECTORY/kde.languages`                &&
    LANGUAGES=`dialog  --backtitle  "KDE i18n Configuration Menu"  \
                       --stdout                                    \
                       --title      "Select language please"       \
                       --checklist                                 \
                       ""                                          \
                       0  50  10                                   \
                       $LANGUAGES`                                 &&
    echo  VERSION=$VERSION  >>  $CFG                               &&

    if  [[  $LANGUAGES  ==  ${LANGUAGES/ALL/}  ]]
    then
      echo  MD5[0]="IGNORE"   >>  $CFG  &&
      local i=1                               &&
      for  LANGUAGE  in  $LANGUAGES
      do
        # BUG HERE	LANGUAGE=${LANGUAGE:1:${#LANGUAGE}-2}
        LANGUAGE=`echo  $LANGUAGE|sed 's:"::g'`  &&
        if  [[  $i  ==  1  ]]
        then
          LANGUAGE=`echo  $LANGUAGE|sed 's:"::g'`                   &&
          echo  SOURCE=$SPELL-$LANGUAGE-$VERSION.tar.bz2  >>  $CFG  &&
          echo  SOURCE_URL[0]=$SITE/\$SOURCE              >>  $CFG
        else
          echo  SOURCE$i=\$SPELL-$LANGUAGE-\$VERSION.tar.bz2  >>  $CFG  &&
          echo  SOURCE${i}_URL[0]=$SITE/\$SOURCE$i            >>  $CFG
        fi  &&
        echo  MD5[$i]="IGNORE"  >>  $CFG  &&
        i=$[$i+1]
      done
    else
       "${MESSAGE_COLOR}ALL is not a valid option${DEFAULT_COLOR}"
#      echo  SOURCE=$SPELL-$VERSION.tar.bz2             >>  $CFG  &&
#      echo  SOURCE_URL[0]=${SITE/$SPELL\//}/\$SOURCE   >>  $CFG  &&
#      echo  MD5[0]="b178f0c33f5f1c70d3bc1e9d31cd7cae"  >>  $CFG
    fi
}

if query "Reconfigure?"  n
then
  get_kdelanguages
else
  message  "${MESSAGE_COLOR}Using existing config${DEFAULT_COLOR}"  &&
  # This is madness! Version number voodoo with regexes bites you in the lower back.
  # Now hardcoding a 3-part version!
  sedit  "s/3\.[0-9]\+\.[0-9]\+/$VERSION/g"  $CFG
fi &&

.  $CFG
