32 lines
1000 B
Bash
32 lines
1000 B
Bash
#!/bin/bash
|
|
|
|
## Script Location
|
|
SCRIPTDIR=$(dirname $0)
|
|
source "$SCRIPTDIR/common/colors.sh"
|
|
source "$SCRIPTDIR/common/functions.sh"
|
|
source "$SCRIPTDIR/common/load-defaults.sh"
|
|
|
|
current_lang=$(locale | grep LANG= | cut -d= -f2)
|
|
printf "$COL_LIGHT_BLUE" "* locale is currently set to $current_lang"
|
|
if [ "$desired_locale" == "ask" ]; then
|
|
dpkg-reconfigure locales
|
|
else
|
|
|
|
update-locale "$desired_locale"
|
|
locale-gen --purge "$desired_locale"
|
|
dpkg-reconfigure --frontend noninteractive locales
|
|
|
|
echo "locales locales/default_environment_locale select $desired_locale" | debconf-set-selections
|
|
echo "locales locales/locales_to_be_generated multiselect $desired_locale" | debconf-set-selections
|
|
rm "/etc/locale.gen"
|
|
dpkg-reconfigure --frontend noninteractive locales
|
|
|
|
systemctl set-environment "LANG=$desired_locale"
|
|
systemctl show-environment
|
|
|
|
. /etc/default/locale
|
|
|
|
fi
|
|
current_lang=$(locale | grep LANG= | cut -d= -f2)
|
|
printf "$COL_LIGHT_BLUE" "* locale is now set to $current_lang"
|