home *** CD-ROM | disk | FTP | other *** search
/ tusportal.tus.k12.pa.us / tusportal.tus.k12.pa.us.tar / tusportal.tus.k12.pa.us / Wyse / latest-image.raw / 0.img / etc / profile.d / lang.sh < prev    next >
Text File  |  2008-10-31  |  2KB  |  90 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. # Already done by the GDM
  17. #
  18. test -z "$GDM_LANG" || return
  19.  
  20. #
  21. # Get the system and after that the users configuration
  22. #
  23. if test -s /etc/sysconfig/language ; then
  24.     while read line ; do
  25.     case "$line" in
  26.     \#*|"")
  27.         continue
  28.         ;;
  29.     RC_*)
  30.         eval ${line#RC_}
  31.         ;;
  32.     ROOT_USES_LANG*)
  33.         eval $line
  34.         test "$UID" != 0 && ROOT_USES_LANG=yes
  35.         ;;
  36.     esac
  37.     done < /etc/sysconfig/language
  38. fi
  39. test -s $HOME/.i18n && . $HOME/.i18n
  40.  
  41. #
  42. # Handle all LC and the LANG variable
  43. #
  44. for lc in LANG LC_CTYPE LC_NUMERIC LC_TIME    \
  45.       LC_COLLATE LC_MONETARY LC_MESSAGES    \
  46.       LC_PAPER LC_NAME LC_ADDRESS         \
  47.       LC_TELEPHONE LC_MEASUREMENT        \
  48.       LC_IDENTIFICATION LC_ALL
  49. do
  50.     eval val="\$$lc"
  51.     if  test "$ROOT_USES_LANG" = "yes"    ; then
  52.     if test -z "$val" ; then
  53.         eval unset $lc
  54.     else
  55.         eval $lc=\$val
  56.         eval export $lc
  57.     fi
  58.     elif test "$ROOT_USES_LANG" = "ctype" ; then
  59.     test "$lc" = "LANG" && continue
  60.     if test "$lc" = "LC_CTYPE" ; then
  61.         LC_CTYPE=$LANG
  62.         LANG=POSIX
  63.         export LANG LC_CTYPE
  64.     else
  65.         eval unset $lc
  66.     fi
  67.     else
  68.     if test "$lc" = "LANG" ; then
  69.         LANG=POSIX
  70.         export LANG
  71.     else
  72.         eval unset $lc
  73.     fi
  74.     fi
  75. done
  76.  
  77. #
  78. # Special LC_ALL handling because the LC_ALL
  79. # overwrites all LC but not the LANG variable
  80. #
  81. if test -n "$LC_ALL" -a "$LC_ALL" != "$LANG" ; then
  82.     export LC_ALL
  83. else
  84.     unset LC_ALL
  85. fi
  86.  
  87. unset line ROOT_USES_LANG lc val
  88. #
  89. # end of lang.sh
  90.