if [ -z "$LOCALE_UTF" ]; then
  LOCALE_UTF=${GLIBC_UTF:-y}
fi  &&
config_query LOCALE_UTF  "Would you like to generate UTF-8 locale data (Unicode) as well as the native charset data?" y  &&
persistent_remove GLIBC_UTF              &&
#
# Don't use config_query here or you'll regret it ;)
# If you do, after a user says 'y' to configuring the locales,
# every subsequent recast will also pop up the locales menu until
# locale is recast with `cast -r locale`, which would also remove
# the selected locales and you'd need to reconfigure them again...
#
if [ -z "$LOCALE_LOCALES" ]; then
  if  [  "$GLIBC_LOCALES"  ]; then
    persistent_add LOCALE_LOCALES  &&
    LOCALE_LOCALES=${GLIBC_LOCALES}
  fi
fi  &&
persistent_remove GLIBC_LOCALES  &&
message "\nThe answer to the next query is saved - you do not need to " &&
message "reselect your locales, unless this spell was triggered by a 'cast -r glibc'." &&
if query "Would you like to select locales? (otherwise all will be built)" n; then
  local  LOCALE_LOCALES_LIST                            &&
  persistent_add  LOCALE_LOCALES                        &&
  BACKTITLE="Locale Configuration"                     &&
      TITLE="Locale Selection"                         &&
       HELP="Translated messages are automatically installed, but the locale database that controls other behavior is not.  
Please select desired locale or locales.
If none are selected then all will be installed."      &&

  #the following awk script enables the locales the user had previously selected, #10256 
  LOCALE_LOCALES_LIST=`awk -v user_locales="$LOCALE_LOCALES" -f "$SCRIPT_DIRECTORY"/preselect.fix.awk "$SCRIPT_DIRECTORY"/locales`  &&
  LOCALE_LOCALES=`dialog  --backtitle  "$BACKTITLE"  \
                         --title      "$TITLE"      \
                         --stdout                   \
                         --checklist  "$HELP"       \
                         0 0 0                      \
                         $LOCALE_LOCALES_LIST`
fi
