[arch-general] changed locale behavior /etc/rc.sysinit

Ian-Xue Li da.mi.spirit at gmail.com
Wed Sep 15 08:22:06 EDT 2010


Hi,

The new /etc/rc.sysinit introduced in initscripts-2010.07-1 has changed
the original behavior of locale settings. 

The Code explains better:

	369	# Flush old locale settings
	370	: >| /etc/profile.d/locale.sh
	371	/bin/chmod 755 /etc/profile.d/locale.sh
	372	# Set user defined locale
	373	[ -z "$LOCALE" ] && LOCALE="en_US"
	375	echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh

Now it flushes /etc/profile.d/locale.sh everytime the system boots. Usually this means
setting `export LANG=en_US.UTF-8' on most computers, and to be included
by shell (.bashrc or .zshrc) everytime, if the user included it at all.
I.e.: source /etc/profile

But for multilingual users, due to the fact that the initial console
only displays ASCII, we often write the local LANG and LC_ALL setting in
xinitrc, so to make an environment that uses English under console and
local (multibyte) language within Xorg.

With the introduction of /etc/profile.d/locale.sh, it would make a
problem that cause Xorg program still using en_US when where we wanted
zh_TW or zh_CN.

My solution is as follows, changing some code in /etc/profile:

	49	if test -d /etc/profile.d/; then
	50	    for profile in /etc/profile.d/*.sh; do
	51	       if [[ $profile == "/etc/profile.d/locale.sh" && -n $DISPLAY ]]; then
	52	          continue
	53	       fi
	54	        test -x $profile && . $profile
	55	    done
	56	    unset profile
	57	fi

-- 
李彥學 (Li Ian-Xue)
http://b4283.ath.cx

A student.


More information about the arch-general mailing list