]>
Commit | Line | Data |
---|---|---|
1 | # /etc/profile.d/lang.sh - set i18n stuff | |
2 | ||
3 | sourced=0 | |
4 | ||
5 | if [ -n "$LANG" ]; then | |
6 | saved_lang="$LANG" | |
7 | [ -f "$HOME/.i18n" ] && . "$HOME/.i18n" && sourced=1 | |
8 | LANG="$saved_lang" | |
9 | unset saved_lang | |
10 | else | |
11 | for langfile in /etc/sysconfig/i18n "$HOME/.i18n" ; do | |
12 | [ -f $langfile ] && . $langfile && sourced=1 | |
13 | done | |
14 | fi | |
15 | ||
16 | if [ "$sourced" = 1 ]; then | |
17 | [ -n "$LANG" ] && export LANG || unset LANG | |
18 | [ -n "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS | |
19 | [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE | |
20 | [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE | |
21 | [ -n "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION || unset LC_IDENTIFICATION | |
22 | [ -n "$LC_MEASUREMENT" ] && export LC_MEASUREMENT || unset LC_MEASUREMENT | |
23 | [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES | |
24 | [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY | |
25 | [ -n "$LC_NAME" ] && export LC_NAME || unset LC_NAME | |
26 | [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC | |
27 | [ -n "$LC_PAPER" ] && export LC_PAPER || unset LC_PAPER | |
28 | [ -n "$LC_TELEPHONE" ] && export LC_TELEPHONE || unset LC_TELEPHONE | |
29 | [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME | |
30 | if [ -n "$LC_ALL" ]; then | |
31 | if [ "$LC_ALL" != "$LANG" ]; then | |
32 | export LC_ALL | |
33 | else | |
34 | unset LC_ALL | |
35 | fi | |
36 | else | |
37 | unset LC_ALL | |
38 | fi | |
39 | [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE | |
40 | [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS | |
41 | [ -n "$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET | |
42 | ||
43 | consoletype=$CONSOLETYPE | |
44 | if [ -z "$consoletype" ]; then | |
45 | consoletype=$(/sbin/consoletype stdout) | |
46 | fi | |
47 | ||
48 | if [ -n "$LANG" ]; then | |
49 | case $LANG in | |
50 | *.utf8*|*.UTF-8*) | |
51 | if [ "$TERM" = "linux" ]; then | |
52 | if [ "$consoletype" = "vt" ]; then | |
53 | case $LANG in | |
54 | ja*) LANG=en_US.UTF-8 ;; | |
55 | ko*) LANG=en_US.UTF-8 ;; | |
56 | si*) LANG=en_US.UTF-8 ;; | |
57 | zh*) LANG=en_US.UTF-8 ;; | |
58 | ar*) LANG=en_US.UTF-8 ;; | |
59 | fa*) LANG=en_US.UTF-8 ;; | |
60 | he*) LANG=en_US.UTF-8 ;; | |
61 | en_IN*) ;; | |
62 | *_IN*) LANG=en_US.UTF-8 ;; | |
63 | esac | |
64 | fi | |
65 | fi | |
66 | ;; | |
67 | *) | |
68 | if [ "$TERM" = "linux" ]; then | |
69 | if [ "$consoletype" = "vt" ]; then | |
70 | case $LANG in | |
71 | ja*) LANG=en_US ;; | |
72 | ko*) LANG=en_US ;; | |
73 | si*) LANG=en_US ;; | |
74 | zh*) LANG=en_US ;; | |
75 | ar*) LANG=en_US ;; | |
76 | fa*) LANG=en_US ;; | |
77 | he*) LANG=en_US ;; | |
78 | en_IN*) ;; | |
79 | *_IN*) LANG=en_US ;; | |
80 | esac | |
81 | fi | |
82 | fi | |
83 | ;; | |
84 | esac | |
85 | fi | |
86 | ||
87 | unset SYSFONTACM SYSFONT consoletype | |
88 | fi | |
89 | unset sourced | |
90 | unset langfile |