commit 36aeb3915e52b957f6a4aba57833b0be9898ac64
Author: Werner Fink <werner@suse.de>
Date:   Thu Feb 25 13:37:27 2016 +0100

    Let the ~/.i18n values parsed as well if GDM_LANG is set (boo#958295)
    
    Signed-off-by: Werner Fink <werner@suse.de>

diff --git a/files/etc/profile.d/lang.csh b/files/etc/profile.d/lang.csh
index 342ab37..0524d40 100644
--- a/files/etc/profile.d/lang.csh
+++ b/files/etc/profile.d/lang.csh
@@ -15,32 +15,46 @@ if ( ${?SSH_SENDS_LOCALE} ) goto end
 #
 # Already done by the GDM
 #
-if ( ${?GDM_LANG} ) goto end
+if ( ${?GDM_LANG} ) then
+    set LANG=$GDM_LANG
+endif
+
+unset _save
+if ( ${?LANG} ) then
+    set _save=$LANG
+endif
 
 #
 # Get the system and after that the users configuration
 #
 if ( -s /etc/sysconfig/language ) then
-    eval `sed -n \
-	-e 's/^RC_\(\(LANG\|LC_[A-Z_]\+\)\)=/set \1=/p' \
-	-e 's/^\(ROOT_USES_LANG\)=/set \1=/p' \
-	< /etc/sysconfig/language`
-    if ( "$uid" != 0 ) set ROOT_USES_LANG=yes
+    if ( ${?LANG} ) then
+	if ( "$uid" == 0 ) then
+	    eval `sed -rn -e 's/^(ROOT_USES_LANG)=/set \1=/p' < /etc/sysconfig/language`
+	else
+	    set ROOT_USES_LANG=yes
+	endif
+    else
+	eval `sed -rn \
+	    -e 's/^RC_((LANG|LC_[A-Z_]+))=/set \1=/p' -e 's/^(ROOT_USES_LANG)=/set \1=/p' \
+	    < /etc/sysconfig/language`
+    endif
 endif
 if ( -s $HOME/.i18n ) then
-    eval `sed -n \
-	-e 's/^\(\(LANG\|LC_[A-Z_]\+\)\)=/set \1=/p' \
-	< $HOME/.i18n`
+    eval `sed -rn -e 's/^((LANG|LC_[A-Z_]+))=/set \1=/p' < $HOME/.i18n`
+endif
+if ( ${?_save} ) then
+    set LANG=$_save
+    unset _save
 endif
 
 #
 # Handle all LC and the LANG variable
 #
-foreach lc (LANG LC_CTYPE LC_NUMERIC LC_TIME	\
-	    LC_COLLATE LC_MONETARY LC_MESSAGES	\
-	    LC_PAPER LC_NAME LC_ADDRESS 	\
-	    LC_TELEPHONE LC_MEASUREMENT		\
-	    LC_IDENTIFICATION LC_ALL)
+foreach lc (LANG LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE    \
+	    LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES  \
+	    LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER       \
+	    LC_TELEPHONE LC_TIME )
     eval set val=\${\?$lc}
     if ( $val == 0 ) continue
     eval set val=\$$lc
@@ -67,6 +81,8 @@ foreach lc (LANG LC_CTYPE LC_NUMERIC LC_TIME	\
     endif
     eval unset $lc
 end
+unset lc val
+unset ROOT_USES_LANG
 
 #
 # Special LC_ALL handling because the LC_ALL
@@ -82,7 +98,6 @@ if ( ${?LC_ALL} ) then
     unset LC_ALL
 endif
 
-unset ROOT_USES_LANG lc val
 end:
 #
 # end of lang.sh
diff --git a/files/etc/profile.d/lang.sh b/files/etc/profile.d/lang.sh
index ff69d0e..4a9c372 100644
--- a/files/etc/profile.d/lang.sh
+++ b/files/etc/profile.d/lang.sh
@@ -15,10 +15,10 @@ test -z "$SSH_SENDS_LOCALE" || return
 #
 # Already done by the GDM
 #
-if test -n "$GDM_LANG"; then
-    test -s $HOME/.i18n && . $HOME/.i18n
-    return
-fi
+test -n "$GDM_LANG" && LANG=$GDM_LANG
+
+unset _save
+test -n "$LANG" && _save="$LANG"
 
 #
 # Get the system and after that the users configuration
@@ -27,28 +27,31 @@ if test -s /etc/sysconfig/language ; then
     while read line ; do
 	case "$line" in
 	\#*|"")
-	    continue
-	    ;;
+		continue
+		;;
 	RC_*)
-	    eval ${line#RC_}
-	    ;;
+		test -n "$LANG" && continue
+		eval ${line#RC_}
+		;;
 	ROOT_USES_LANG*)
-	    eval $line
-	    test "$UID" != 0 && ROOT_USES_LANG=yes
-	    ;;
+		test "$UID" = 0 && eval $line || ROOT_USES_LANG=yes
+		;;
 	esac
     done < /etc/sysconfig/language
+    unset line
 fi
 test -s $HOME/.i18n && . $HOME/.i18n
 
+test -n "$_save" && LANG="$_save"
+unset _save
+
 #
 # Handle all LC and the LANG variable
 #
-for lc in LANG LC_CTYPE LC_NUMERIC LC_TIME	\
-	  LC_COLLATE LC_MONETARY LC_MESSAGES	\
-	  LC_PAPER LC_NAME LC_ADDRESS 		\
-	  LC_TELEPHONE LC_MEASUREMENT		\
-	  LC_IDENTIFICATION LC_ALL
+for lc in LANG LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE	\
+	  LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES	\
+	  LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER	\
+	  LC_TELEPHONE LC_TIME
 do
     eval val="\$$lc"
     if  test "$ROOT_USES_LANG" = "yes"    ; then
@@ -77,6 +80,9 @@ do
     fi
 done
 
+unset lc val
+unset ROOT_USES_LANG
+
 #
 # Special LC_ALL handling because the LC_ALL
 # overwrites all LC but not the LANG variable
@@ -87,6 +93,5 @@ else
     unset LC_ALL
 fi
 
-unset line ROOT_USES_LANG lc val
 #
 # end of lang.sh
