#Desktop-session startup scripts
user_locale="$HOME/.config/locale";
system_locale="/etc/default/locale";

load_locale() {
	local LOCALE_VALUES
	# Unset all locale variables
	unset $(locale | cut -d"=" -f1)
	
	# Load the correct locales
	if [ -f "$user_locale" ] && [ $(grep -c -e "^LANG\|^LC_" "$user_locale") -gt 0 ]; then
		LOCALE_VALUES="$(grep -v -e "^#\|^$" "$user_locale")"
	elif [ -f "$system_locale" ]; then
		LOCALE_VALUES="$(grep -v -e "^#\|^$" "$system_locale")"
	fi
	export $LOCALE_VALUES
	
	# Check for when LANG is empty, and use the C code
	[ -z "$LANG" ] && export LANG=C
}
