6b5a23
diff --git a/lang.csh b/lang.csh
6b5a23
index 67faefc..1dc78f8 100644
6b5a23
--- a/lang.csh
6b5a23
+++ b/lang.csh
6b5a23
@@ -34,45 +34,47 @@ endif
6b5a23
 # The ${LANG} manipulation is necessary only in virtual terminal (a.k.a. console - /dev/tty*):
6b5a23
 set in_console=`tty | grep -vc -e '/dev/tty'`
6b5a23
 
6b5a23
-if (${?LANG} && ${TERM} == 'linux' && in_console == 0) then
6b5a23
-    set utf8_used=`echo ${LANG} | grep --quiet -E -i -e '^.+\.utf-?8$'; echo $?`
6b5a23
+if (${?LANG} && ${?TERM}) then
6b5a23
+    if (${TERM} == 'linux' && $in_console == 0) then
6b5a23
+        set utf8_used=`echo ${LANG} | grep --quiet -E -i -e '^.+\.utf-?8$'; echo $?`
6b5a23
 
6b5a23
-    if (${utf8_used} == 0) then
6b5a23
-        switch (${LANG})
6b5a23
-            case en_IN*:
6b5a23
-                breaksw
6b5a23
+        if (${utf8_used} == 0) then
6b5a23
+            switch (${LANG})
6b5a23
+                case en_IN*:
6b5a23
+                    breaksw
6b5a23
 
6b5a23
-            case ja*:
6b5a23
-            case ko*:
6b5a23
-            case si*:
6b5a23
-            case zh*:
6b5a23
-            case ar*:
6b5a23
-            case fa*:
6b5a23
-            case he*:
6b5a23
-            case *_IN*:
6b5a23
-                setenv LANG en_US.UTF-8
6b5a23
-                breaksw
6b5a23
-        endsw
6b5a23
-    else
6b5a23
-        switch (${LANG})
6b5a23
-            case en_IN*:
6b5a23
-                breaksw
6b5a23
-            case ja*:
6b5a23
-            case ko*:
6b5a23
-            case si*:
6b5a23
-            case zh*:
6b5a23
-            m case ar*:
6b5a23
-            case fa*:
6b5a23
-            case he*:
6b5a23
-            case *_IN*:
6b5a23
-                setenv LANG en_US
6b5a23
-                breaksw
6b5a23
-        endsw
6b5a23
-    endif
6b5a23
+                case ja*:
6b5a23
+                case ko*:
6b5a23
+                case si*:
6b5a23
+                case zh*:
6b5a23
+                case ar*:
6b5a23
+                case fa*:
6b5a23
+                case he*:
6b5a23
+                case *_IN*:
6b5a23
+                    setenv LANG en_US.UTF-8
6b5a23
+                    breaksw
6b5a23
+            endsw
6b5a23
+        else
6b5a23
+            switch (${LANG})
6b5a23
+                case en_IN*:
6b5a23
+                    breaksw
6b5a23
+                case ja*:
6b5a23
+                case ko*:
6b5a23
+                case si*:
6b5a23
+                case zh*:
6b5a23
+                case ar*:
6b5a23
+                case fa*:
6b5a23
+                case he*:
6b5a23
+                case *_IN*:
6b5a23
+                    setenv LANG en_US
6b5a23
+                    breaksw
6b5a23
+            endsw
6b5a23
+        endif
6b5a23
 
6b5a23
-    # NOTE: We are not exporting the ${LANG} here again on purpose.
6b5a23
-    #       If user starts GUI session from console manually, then
6b5a23
-    #       the previously set LANG should be okay to use.
6b5a23
+        # NOTE: We are not exporting the ${LANG} here again on purpose.
6b5a23
+        #       If user starts GUI session from console manually, then
6b5a23
+        #       the previously set LANG should be okay to use.
6b5a23
+    endif
6b5a23
 endif
6b5a23
 
6b5a23
 unset in_console utf8_used