home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20110725.etc.tar.gz / bradford.20110725.etc.tar / etc / profile.d / lang.sh < prev    next >
Text File  |  2005-08-02  |  2KB  |  85 lines

  1. #
  2. # lang.sh:    Set interactive language environment
  3. #
  4. # Used configuration files:
  5. #
  6. #     /etc/sysconfig/language
  7. #     $HOME/.i18n
  8. #
  9.  
  10. #
  11. # Already done by the remote SSH side
  12. #
  13. test -z "$SSH_SENDS_LOCALE" || return
  14.  
  15. #
  16. # Get the system and after that the users configuration
  17. #
  18. if test -s /etc/sysconfig/language ; then
  19.     while read line ; do
  20.     case "$line" in
  21.     \#*|"")
  22.         continue
  23.         ;;
  24.     RC_*)
  25.         eval ${line#RC_}
  26.         ;;
  27.     ROOT_USES_LANG*)
  28.         eval $line
  29.         test "$UID" != 0 && ROOT_USES_LANG=yes
  30.         ;;
  31.     esac
  32.     done < /etc/sysconfig/language
  33. fi
  34. test -s $HOME/.i18n && . $HOME/.i18n
  35.  
  36. #
  37. # Handle all LC and the LANG variable
  38. #
  39. for lc in LANG LC_CTYPE LC_NUMERIC LC_TIME    \
  40.       LC_COLLATE LC_MONETARY LC_MESSAGES    \
  41.       LC_PAPER LC_NAME LC_ADDRESS         \
  42.       LC_TELEPHONE LC_MEASUREMENT        \
  43.       LC_IDENTIFICATION LC_ALL
  44. do
  45.     eval val="\$$lc"
  46.     if  test "$ROOT_USES_LANG" = "yes"    ; then
  47.     if test -z "$val" ; then
  48.         eval unset $lc
  49.     else
  50.         eval $lc=\$val
  51.         eval export $lc
  52.     fi
  53.     elif test "$ROOT_USES_LANG" = "ctype" ; then
  54.     test "$lc" = "LANG" && continue
  55.     if test "$lc" = "LC_CTYPE" ; then
  56.         LC_CTYPE=$LANG
  57.         LANG=POSIX
  58.         export LANG LC_CTYPE
  59.     else
  60.         eval unset $lc
  61.     fi
  62.     else
  63.     if test "$lc" = "LANG" ; then
  64.         LANG=POSIX
  65.         export LANG
  66.     else
  67.         eval unset $lc
  68.     fi
  69.     fi
  70. done
  71.  
  72. #
  73. # Special LC_ALL handling because the LC_ALL
  74. # overwrites all LC but not the LANG variable
  75. #
  76. if test -n "$LC_ALL" -a "$LC_ALL" != "$LANG" ; then
  77.     export LC_ALL
  78. else
  79.     unset LC_ALL
  80. fi
  81.  
  82. unset line ROOT_USES_LANG lc val
  83. #
  84. # end of lang.sh
  85.