[PATCH 02/17] Import gettext in iutil instead of passing the module reference to iutil

David Shea dshea at redhat.com
Sun Sep 21 19:36:54 UTC 2014


I mean, the module is always going to be gettext, so doing it this way
just seems kind of silly now.
---
 anaconda            |  2 +-
 pyanaconda/iutil.py | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/anaconda b/anaconda
index 0e25eda..64cbdc8 100755
--- a/anaconda
+++ b/anaconda
@@ -998,7 +998,7 @@ if __name__ == "__main__":
 
     from pyanaconda.anaconda import Anaconda
     anaconda = Anaconda()
-    iutil.setup_translations(gettext)
+    iutil.setup_translations()
 
     # reset python's default SIGINT handler
     signal.signal(signal.SIGINT, signal.SIG_IGN)
diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index 0a70917..a849df8 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -34,6 +34,7 @@ import re
 from threading import Thread
 from Queue import Queue, Empty
 from urllib import quote, unquote
+import gettext
 
 from pyanaconda.flags import flags
 from pyanaconda.constants import DRACUT_SHUTDOWN_EJECT, TRANSLATIONS_UPDATE_DIR, UNSUPPORTED_HW
@@ -397,7 +398,7 @@ def parseNfsUrl(nfsurl):
 
     return (options, host, path)
 
-def add_po_path(module, directory):
+def add_po_path(directory):
     """ Looks to see what translations are under a given path and tells
     the gettext module to use that path as the base dir """
     for d in os.listdir(directory):
@@ -409,12 +410,12 @@ def add_po_path(module, directory):
             if not basename.endswith(".mo"):
                 continue
             log.info("setting %s as translation source for %s", directory, basename[:-3])
-            module.bindtextdomain(basename[:-3], directory)
+            gettext.bindtextdomain(basename[:-3], directory)
 
-def setup_translations(module):
+def setup_translations():
     if os.path.isdir(TRANSLATIONS_UPDATE_DIR):
-        add_po_path(module, TRANSLATIONS_UPDATE_DIR)
-    module.textdomain("anaconda")
+        add_po_path(TRANSLATIONS_UPDATE_DIR)
+    gettext.textdomain("anaconda")
 
 def _run_systemctl(command, service):
     """
-- 
1.9.3



More information about the anaconda-patches mailing list