Skip to content

Instantly share code, notes, and snippets.

@oreo639
Created March 1, 2024 02:23
Show Gist options
  • Save oreo639/850ddb140df502781f1f54fc1ffaba0c to your computer and use it in GitHub Desktop.
Save oreo639/850ddb140df502781f1f54fc1ffaba0c to your computer and use it in GitHub Desktop.
# Sets up locale system settings from /etc/locale.conf.
#
_localevars="LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
LC_IDENTIFICATION"
for a in $_localevars; do
eval '_backup_'${a}'="$'${a}'"'
done
if [ -s /etc/locale.conf ]; then
. /etc/locale.conf
fi
for a in $_localevars; do
eval 'if [ -n "$_backup_'${a}'" ]; then
'${a}'="$_backup_'${a}'"
fi'
unset "_backup_${a}"
done
# define default LANG to C.UTF-8 if not already defined
LANG="${LANG:-C.UTF-8}"
export $_localevars
unset _localevars a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment