ROOT_URL=ftp://ftp.ac-grenoble.fr/ge/languages/babylon_dict/

get_languages()  {
  LANGUAGES=`cat $SCRIPT_DIRECTORY/languages`
  LANGUAGES=`dialog  --backtitle  "Languages Selection Menu" \
                    --stdout                                   \
                    --title      "Select language please"      \
                    --checklist                                \
                    ""                                         \
                    0 50 10                                     \
                    $LANGUAGES`
  if [[ $LANGUAGES == ${LANGUAGES/ALL/} ]]
  then
    r=3
    cat /dev/null > $BUILD_DIRECTORY/choice

   for LANGUAGE in $LANGUAGES
    do
      LANGUAGE=`echo $LANGUAGE | sed s/\"//g`
      echo SOURCE${r}=Engto$LANGUAGE.dic.gz >> $BUILD_DIRECTORY/choice
      echo SOURCE${r}_URL=$ROOT_URL\$SOURCE$r >> $BUILD_DIRECTORY/choice
      r=$[$r+1]
   done
  fi
}
get_languages
. $BUILD_DIRECTORY/choice
