diff options
author | Tom Gundersen <teg@jklm.no> | 2011-10-24 21:34:14 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2011-10-29 17:28:45 +0200 |
commit | fbff8c64e2be9cbb24bd7f824552842d0bd6442d (patch) | |
tree | 01d06d83658f1057f95ab6037f1728cf59f3a96e /locale.sh | |
parent | 1fdaa33f06786231da3b86e5d8b646b46f6ca1f9 (diff) |
locale: fix locale.sh for zsh
Uglier script, but should now work with zsh as well as bash.
v2: only read rc.conf if LANG is not set in locale.conf, no
functional change. Based on suggestion by Dave.
Signed-off-by: Tom Gundersen <teg@jklm.no>
Diffstat (limited to 'locale.sh')
-rw-r--r-- | locale.sh | 81 |
1 files changed, 75 insertions, 6 deletions
@@ -1,10 +1,79 @@ -if [ -s /etc/rc.conf ]; then - LANG=$(. /etc/rc.conf 2> /dev/null ; echo "${LOCALE:=en_US.UTF-8}") -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 + if [ -s /etc/rc.conf ]; then + export LANG=$(. /etc/rc.conf 2> /dev/null ; echo "$LOCALE") + else + export LANG="C" + fi +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 |