[arch-projects] [PATCH 6/7] locale: fix locale.sh for zsh
Tom Gundersen
teg at jklm.no
Wed Oct 26 19:38:32 EDT 2011
Uglier script, but should now work with zsh as well as bash.
Signed-off-by: Tom Gundersen <teg at jklm.no>
---
locale.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/locale.sh b/locale.sh
index e774659..4b4ef4e 100644
--- a/locale.sh
+++ b/locale.sh
@@ -1,10 +1,79 @@
if [ -s /etc/rc.conf ]; then
- LANG=$(. /etc/rc.conf 2> /dev/null ; echo "${LOCALE:=en_US.UTF-8}")
+ LANG=$(. /etc/rc.conf 2> /dev/null ; echo "$LOCALE")
fi
+
if [ -s /etc/locale.conf ]; then
. /etc/locale.conf
fi
-export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE
-export LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS
-export LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
+if [ -n "$LANG" ]; then
+ export LANG
+else
+ export LANG="C"
+fi
+
+if [ -n "$LC_CTYPE" ]; then
+ export LC_CTYPE
+else
+ unset LC_CTYPE
+fi
+
+if [ -n "$LC_NUMERIC" ]; then
+ export LC_NUMERIC
+else
+ unset LC_NUMERIC
+fi
+
+if [ -n "$LC_TIME" ]; then
+ export LC_TIME
+else
+ unset LC_TIME
+fi
+
+if [ -n "$LC_COLLATE" ]; then
+ export LC_COLLATE
+else
+ unset LC_COLLATE
+fi
+
+if [ -n "$LC_MONETARY" ]; then
+ export LC_MONETARY
+else
+ unset LC_MONETARY
+fi
+
+if [ -n "$LC_MESSAGES" ]; then
+ export LC_MESSAGES
+else
+ unset LC_MESSAGES
+fi
+
+if [ -n "$LC_PAPER" ]; then
+ export LC_PAPER
+else
+ unset LC_PAPER
+fi
+
+if [ -n "$LC_NAME" ]; then
+ export LC_NAME
+else
+ unset LC_NAME
+fi
+
+if [ -n "$LC_ADDRESS" ]; then
+ export LC_ADDRESS
+else
+ unset LC_ADDRESS
+fi
+
+if [ -n "$LC_TELEPHONE" ]; then
+ export LC_MEASUREMENT
+else
+ unset LC_MEASUREMENT
+fi
+
+if [ -n "$LC_IDENTIFICATION" ]; then
+ export LC_IDENTIFICATION
+else
+ unset LC_IDENTIFICATION
+fi
--
1.7.7.1
More information about the arch-projects
mailing list