[f22-branch 2/3] Consolidate the language environment variables. (#1209563)

dashea installerbot-noreply at redhat.com
Fri Apr 10 15:18:16 UTC 2015


From: David Shea <dshea at redhat.com>

Grab language information from $LANGUAGE, $LC_ALL, or $LC_MESSAGES, if
available, and then clear all these extra variables so we don't need to
worry about them when switching languages.
---
 anaconda | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/anaconda b/anaconda
index ad0a69c..5eccbb7 100755
--- a/anaconda
+++ b/anaconda
@@ -1219,6 +1219,20 @@ if __name__ == "__main__":
     from pyanaconda import localization
     # Set the language before loading an interface, when it may be too late.
 
+    # GNU defines four (four!) ways to set the locale via the environment.
+    # At least three of those are just going to get in the way of anaconda's
+    # 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
+
+    for varname in ("LANGUAGE", "LC_ALL", "LC_MESSAGES"):
+        if varname in os.environ:
+            del os.environ[varname] # pylint: disable=environment-modify
+
     # first, try to load firmware language if nothing is already set in
     # the environment
     if "LANG" not in os.environ:


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


More information about the anaconda-patches mailing list