Related: rhbz#598413 --- anaconda | 21 +-------------------- constants.py | 1 + gui.py | 1 + iutil.py | 19 +++++++++++++++++++ 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/anaconda b/anaconda index 17003c9..9d2cfa6 100755 --- a/anaconda +++ b/anaconda @@ -275,25 +275,6 @@ def setupPythonPath(): sys.path.append('/usr/share/system-config-date') -def addPoPath(dir): - """ 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(dir): - if not os.path.isdir("%s/%s" %(dir,d)): - continue - if not os.path.exists("%s/%s/LC_MESSAGES" %(dir,d)): - continue - for basename in os.listdir("%s/%s/LC_MESSAGES" %(dir,d)): - if not basename.endswith(".mo"): - continue - log.info("setting %s as translation source for %s" %(dir, basename[:-3])) - gettext.bindtextdomain(basename[:-3], dir) - -def setupTranslations(): - if os.path.isdir("/tmp/updates/po"): - addPoPath("/tmp/updates/po") - gettext.textdomain("anaconda") - def setupEnvironment(): # Silly GNOME stuff if os.environ.has_key('HOME') and not os.environ.has_key("XAUTHORITY"): @@ -678,7 +659,7 @@ if __name__ == "__main__": warnings.showwarning = AnacondaShowWarning - setupTranslations() + iutil.setup_translations(gettext) # reset python's default SIGINT handler signal.signal(signal.SIGINT, signal.SIG_DFL) diff --git a/constants.py b/constants.py index fb81c90..e6fbd3b 100644 --- a/constants.py +++ b/constants.py @@ -87,3 +87,4 @@ else: DD_EXTRACTED = "/tmp/DD" DD_RPMS = "/tmp/DD-*" +TRANSLATIONS_UPDATE_DIR="/tmp/updates/po" diff --git a/gui.py b/gui.py index b2b5bf6..24a2579 100755 --- a/gui.py +++ b/gui.py @@ -53,6 +53,7 @@ import logging log = logging.getLogger("anaconda") isys.bind_textdomain_codeset("redhat-dist", "UTF-8") +iutil.setup_translations(gtk.glade) class StayOnScreen(Exception): pass diff --git a/iutil.py b/iutil.py index a568ff7..5cd6bb2 100644 --- a/iutil.py +++ b/iutil.py @@ -1058,3 +1058,22 @@ def parseNfsUrl(nfsurl): else: host = s[0] return (options, host, path) + +def add_po_path(module, dir): + """ 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(dir): + if not os.path.isdir("%s/%s" %(dir,d)): + continue + if not os.path.exists("%s/%s/LC_MESSAGES" %(dir,d)): + continue + for basename in os.listdir("%s/%s/LC_MESSAGES" %(dir,d)): + if not basename.endswith(".mo"): + continue + log.info("setting %s as translation source for %s" %(dir, basename[:-3])) + module.bindtextdomain(basename[:-3], dir) + +def setup_translations(module): + if os.path.isdir(TRANSLATIONS_UPDATE_DIR): + add_po_path(module, TRANSLATIONS_UPDATE_DIR) + module.textdomain("anaconda") -- 1.7.0.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list