Properly handle empty locale selection
This commit is contained in:
parent
f4a89b7a25
commit
5a56df3d36
1 changed files with 26 additions and 20 deletions
|
@ -51,17 +51,21 @@ _acp_set_locale () {
|
|||
list)
|
||||
localectl list-locales
|
||||
;;
|
||||
"")
|
||||
LANG=C
|
||||
_acp_locale_selected=1
|
||||
;;
|
||||
*)
|
||||
if [ $(localectl list-locales | grep "$_acp_entered_locale" | wc -l) -eq 0 ]
|
||||
if [ $(localectl list-locales | grep "${_acp_entered_locale}" | wc -l) -eq 0 ]
|
||||
then
|
||||
echo "Invalid locale entered."
|
||||
continue
|
||||
fi
|
||||
if [ -z "$_acp_entered_locale" ]
|
||||
then
|
||||
LANG=C.utf8
|
||||
else
|
||||
LANG="$_acp_entered_locale"
|
||||
fi
|
||||
_acp_locale_selected=1
|
||||
;;
|
||||
esac
|
||||
LC_COLLATE="$LANG" # Alphabetic sorting.
|
||||
LC_CTYPE="$LANG" # Interpretation of byte sequences.
|
||||
LC_IDENTIFICATION="$LANG" # Locale metadata (GNU).
|
||||
|
@ -74,12 +78,14 @@ _acp_set_locale () {
|
|||
LC_MONETARY="$LANG" # Currency display.
|
||||
LC_PAPER="$LANG" # Standard paper size -- A4 or Letter (GNU).
|
||||
LC_TELEPHONE="$LANG" # Formats for telephone services (GNU).
|
||||
if [ ! -z "$_acp_entered_locale" ]
|
||||
then
|
||||
rm -f "$HOME/.config/locale.conf"
|
||||
locale > "$HOME/.config/locale.conf"
|
||||
_acp_locale_selected=1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
unset _acp_locale_selected
|
||||
unset _acp_entered_locale
|
||||
}
|
||||
|
||||
if [ -r "$HOME/.config/locale.conf" ]
|
||||
|
|
Loading…
Reference in a new issue