[f22-branch 1/1] Don't use $LANGUAGE if empty (#1222262)

dashea installerbot-noreply at redhat.com
Mon May 18 14:06:15 UTC 2015


From: David Shea <dshea at redhat.com>

KDE sets $LANGUAGE to an empty string for some mysterious reason, and
they know about it, and they ain't gonna fix it. Ignore $LANGUAGE if
it's an empty string because a careful reading of the man page says that
$LANGUAGE only counts if it contains something and an empty $LANGUAGE
breaks everything.
---
 anaconda | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/anaconda b/anaconda
index c17c797..f1b5dc0 100755
--- a/anaconda
+++ b/anaconda
@@ -1224,10 +1224,17 @@ if __name__ == "__main__":
     # ability to set the language and locale after startup. If any of, in
     # order, $LANGUAGE, $LC_ALL, or $LC_MESSAGES is in the environment, copy
     # the information to $LANG, and then clear the rest.
-    for varname in ("LANGUAGE", "LC_ALL", "LC_MESSAGES"):
-        if varname in os.environ:
-            os.environ["LANG"] = os.environ[varname] # pylint: disable=environment-modify
-            break
+
+    # $LANGUAGE is a GNU gettext extension, and is defined as being used only
+    # if set to a nonempty value. Annoyingly, some programs (KDE) do set
+    # LANGUAGE to an empty value and then expect everyone not to use it.
+    if "LANGUAGE" in os.environ and os.environ["LANGUAGE"]:
+        os.environ["LANG"] = os.environ["LANGUAGE"] # pylint: disable=environment-modify
+    else:
+        for varname in ("LC_ALL", "LC_MESSAGES"):
+            if varname in os.environ:
+                os.environ["LANG"] = os.environ[varname] # pylint: disable=environment-modify
+                break
 
     for varname in ("LANGUAGE", "LC_ALL", "LC_MESSAGES"):
         if varname in os.environ:


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/22d68f1f5febeb1560221a70776978f764bcde1b


More information about the anaconda-patches mailing list