[PATCH 6/6] If lang= was provided on the command line, set the installation language.

Chris Lumens clumens at redhat.com
Thu Nov 1 19:55:37 UTC 2012


---
 anaconda | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/anaconda b/anaconda
index 745097f..35fb5ce 100755
--- a/anaconda
+++ b/anaconda
@@ -891,6 +891,30 @@ if __name__ == "__main__":
         else:
             log.error("Unknown method: %s", (anaconda.methodstr,))
 
+    # Set the language before loading an interface, when it may be too late.
+    if opts.lang:
+        from pyanaconda.localization import Language, LOCALE_PREFERENCES, expand_langs
+
+        langObj = Language(LOCALE_PREFERENCES, territory=None)
+
+        # Given something other than the long format we prefer?  We need to
+        # dig through supported translations to figure out what the user
+        # meant.
+        if not opts.lang in langObj.translations:
+            foundLang = False
+
+            for trans in langObj.translations.keys():
+                if opts.lang in expand_langs(trans):
+                    opts.lang = trans
+                    foundLang = True
+                    break
+
+            if not foundLang:
+                opts.lang = "en_US.UTF-8"
+
+        langObj.set_install_lang(opts.lang)
+        ksdata.lang.lang = opts.lang
+
     # init threading before Gtk can do anything
     from pyanaconda.threads import initThreading, threadMgr, AnacondaThread
     initThreading()
-- 
1.7.11.2



More information about the anaconda-patches mailing list