aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlang.csh17
-rwxr-xr-xlang.sh15
2 files changed, 17 insertions, 15 deletions
diff --git a/lang.csh b/lang.csh
index 6a4867b7..0fd1e498 100755
--- a/lang.csh
+++ b/lang.csh
@@ -1,21 +1,22 @@
# /etc/profile.d/lang.csh - set i18n stuff
set sourced=0
+
if ($?LANG) then
- set sourced=1
set saved_lang=$LANG
-endif
-
-foreach file (/etc/sysconfig/i18n $HOME/.i18n)
- if ( -f $file ) then
+ if ( -f $HOME/.i18n ) then
eval `grep -v '^[:blank:]*#' $file | sed 's|\([^=]*\)=\([^=]*\)|setenv \1 \2|g' | sed 's|$|;|'`
set sourced=1
endif
-end
-
-if ($?saved_lang) then
setenv LANG $saved_lang
unset saved_lang
+else
+ foreach file (/etc/sysconfig/i18n $HOME/.i18n)
+ if ( -f $file ) then
+ eval `grep -v '^[:blank:]*#' $file | sed 's|\([^=]*\)=\([^=]*\)|setenv \1 \2|g' | sed 's|$|;|'`
+ set sourced=1
+ endif
+ end
endif
if ($sourced == 1) then
diff --git a/lang.sh b/lang.sh
index 705e7a58..7fe9e3ff 100755
--- a/lang.sh
+++ b/lang.sh
@@ -2,15 +2,16 @@
sourced=0
-saved_lang="$LANG"
-for langfile in /etc/sysconfig/i18n $HOME/.i18n ; do
- [ -f $langfile ] && . $langfile && sourced=1
-done
-
-if [ -n "$saved_lang" ]; then
+if [ -n "$LANG" ]; then
+ saved_lang="$LANG"
+ [ -f $HOME/.i18n ] && . $HOME/.i18n && sourced=1
LANG="$saved_lang"
+ unset saved_lang
+else
+ for langfile in /etc/sysconfig/i18n $HOME/.i18n ; do
+ [ -f $langfile ] && . $langfile && sourced=1
+ done
fi
-unset saved_lang
if [ "$sourced" = 1 ]; then
[ -n "$LANG" ] && export LANG || unset LANG