summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-10-01 10:20:30 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-10-01 10:20:30 -1000
commit576d6d67ded60eac2133f324c20d3484904ea475 (patch)
tree278161e765bfd939d2fb113aae9e7bf6f1fed06a
parent89f97834a415fa9aafa0824e7603fe8091058efb (diff)
downloadanaconda-576d6d67ded60eac2133f324c20d3484904ea475.tar.gz
anaconda-576d6d67ded60eac2133f324c20d3484904ea475.tar.xz
anaconda-576d6d67ded60eac2133f324c20d3484904ea475.zip
Use named parameters for translatable strings with multiple params.
This is a cleanup for the po files. xgettext displays the following messages for some Python files: warning: 'msgid' format string with unnamed arguments cannot be properly localized: The translator cannot reorder the arguments. Please consider using a format string with named arguments, and a mapping instead of a tuple for the arguments. This patch modifies the reported format strings to use named parameters per the warning message. We were already using these style format strings in users.py and possibly other files. Basically when there is more than one parameter in the format string, we should use a hash table with named parameters.
-rw-r--r--image.py7
-rw-r--r--iutil.py28
-rw-r--r--iw/GroupSelector.py3
-rw-r--r--iw/autopart_type.py8
-rw-r--r--iw/lvm_dialog_gui.py38
-rw-r--r--iw/netconfig_dialog.py3
-rw-r--r--iw/network_gui.py8
-rw-r--r--iw/partition_gui.py6
-rw-r--r--iw/raid_dialog_gui.py6
-rw-r--r--iw/task_gui.py5
-rw-r--r--iw/upgrade_bootloader_gui.py6
-rw-r--r--iw/upgrade_migratefs_gui.py6
-rw-r--r--kickstart.py7
-rw-r--r--packages.py10
-rw-r--r--partIntfHelpers.py10
-rw-r--r--rescue.py6
-rw-r--r--storage/__init__.py56
-rw-r--r--storage/devicetree.py16
-rw-r--r--storage/partitioning.py9
-rw-r--r--storage/zfcp.py91
-rw-r--r--text.py2
-rw-r--r--textw/netconfig_text.py4
-rw-r--r--textw/upgrade_bootloader_text.py7
-rw-r--r--textw/upgrade_text.py6
-rw-r--r--vnc.py10
-rw-r--r--yuminstall.py39
26 files changed, 241 insertions, 156 deletions
diff --git a/image.py b/image.py
index 889c2fe26..8ae097077 100644
--- a/image.py
+++ b/image.py
@@ -240,10 +240,13 @@ def presentRequiredMediaMessage(anaconda):
return anaconda.intf.messageWindow(_("Required Install Media"),
_("The software you have selected to install will require the "
- "following %s %s discs:\n\n%s\nPlease have these ready "
+ "following %(productName)s %(productVersion)s "
+ "discs:\n\n%(reqcdstr)s\nPlease have these ready "
"before proceeding with the installation. If you need to "
"abort the installation and exit please select "
- "\"Reboot\".") % (product.productName, product.productVersion, reqcdstr),
+ "\"Reboot\".") % {'productName': product.productName,
+ 'productVersion': product.productVersion,
+ 'reqcdstr': reqcdstr},
type="custom", custom_icon="warning",
custom_buttons=[_("_Reboot"), _("_Back"), _("_Continue")])
diff --git a/iutil.py b/iutil.py
index 34220098b..5316dceb0 100644
--- a/iutil.py
+++ b/iutil.py
@@ -828,7 +828,10 @@ def writeReiplMethod(reipl_path, reipl_type):
try:
f = open(filename, "w")
except Exception, e:
- message = _("Error: On open, cannot set reIPL method to %s (%s: %s)" % (reipl_type,filename,e,))
+ message = _("Error: On open, cannot set reIPL method to %(reipl_type)s "
+ "(%(filename)s: %(e)s)" % {'reipl_type': reipl_type,
+ 'filename': filename,
+ 'e': e})
log.warning(message)
raise Exception (message)
@@ -836,14 +839,18 @@ def writeReiplMethod(reipl_path, reipl_type):
f.write(reipl_type)
f.flush()
except Exception, e:
- message = _("Error: On write, cannot set reIPL method to %s (%s: %s)" % (reipl_type,filename,e,))
+ message = _("Error: On write, cannot set reIPL method to "
+ "%(reipl_type)s (%(filename)s: %(e)s)" \
+ % {'reipl_type': reipl_type, 'filename': filename, 'e': e})
log.warning(message)
raise Exception (message)
try:
f.close()
except Exception, e:
- message = _("Error: On close, cannot set reIPL method to %s (%s: %s)" % (reipl_type,filename,e,))
+ message = _("Error: On close, cannot set reIPL method to "
+ "%(reipl_type)s (%(filename)s: %(e)s)" \
+ % {'reipl_type': reipl_type, 'filename': filename, 'e': e})
log.warning(message)
raise Exception (message)
@@ -860,7 +867,8 @@ def reIPLonCCW(iplsubdev, reipl_path):
f.write(device)
f.close()
except Exception, e:
- message = _("Error: Could not set %s as reIPL device (%s)" % (device,e,))
+ message = _("Error: Could not set %(device)s as reIPL device "
+ "(%(e)s)" % {'device': device, 'e': e})
log.warning(message)
raise Exception (message)
@@ -910,7 +918,9 @@ def reIPLonFCP(iplsubdev, reipl_path):
fcpvalue[reipl_property] = value
f.close()
except Exception, e:
- message = _("Error: reading FCP property %s for reIPL (%s)" % (syspath_property,e,))
+ message = _("Error: reading FCP property %(syspath_property)s "
+ "for reIPL (%(e)s)" \
+ % {'syspath_property': syspath_property, 'e': e})
log.warning(message)
raise Exception (message)
@@ -923,7 +933,9 @@ def reIPLonFCP(iplsubdev, reipl_path):
f.write(fcpvalue[reipl_property])
f.close()
except Exception, e:
- message = _("Error: writing FCP property %s for reIPL (%s)" % (reipl_property,e,))
+ message = _("Error: writing FCP property %(reipl_property)s "
+ "for reIPL (%(e)s)" \
+ % {'reipl_property': reipl_property, 'e': e})
log.warning(message)
raise Exception (message)
@@ -936,7 +948,9 @@ def reIPLonFCP(iplsubdev, reipl_path):
f.write (default_value)
f.close()
except Exception, e:
- message = _("Error: writing default FCP property %s for reIPL (%s)" % (reipl_property,e,))
+ message = _("Error: writing default FCP property "
+ "%(reipl_property)s for reIPL (%(e)s)" \
+ % {'reipl_property': reipl_property, 'e': e})
log.warning(message)
raise Exception (message)
diff --git a/iw/GroupSelector.py b/iw/GroupSelector.py
index 504f83d46..4d64e59a0 100644
--- a/iw/GroupSelector.py
+++ b/iw/GroupSelector.py
@@ -421,7 +421,8 @@ class GroupSelector:
self.xml.get_widget("optionalLabel").set_text("")
else:
self.xml.get_widget("detailsButton").set_sensitive(True)
- txt = _("Optional packages selected: %d of %d") % (inst, cnt)
+ txt = _("Optional packages selected: %(inst)d of %(cnt)d") \
+ % {'inst': inst, 'cnt': cnt}
self.xml.get_widget("optionalLabel").set_markup(_("<i>%s</i>") %(txt,))
def _groupToggled(self, widget, path, sel = None, updateText = True):
diff --git a/iw/autopart_type.py b/iw/autopart_type.py
index fb5e5f29a..e41f618b5 100644
--- a/iw/autopart_type.py
+++ b/iw/autopart_type.py
@@ -121,8 +121,9 @@ def whichToShrink(storage, intf):
actions.append(ActionResizeFormat(request, newSize))
except ValueError as e:
intf.messageWindow(_("Resize FileSystem Error"),
- _("%s: %s") % (request.format.device,
- e.message,),
+ _("%(device)s: %(msg)s")
+ % {'device': request.format.device,
+ 'msg': e.message},
type="warning", custom_icon="error")
continue
@@ -130,7 +131,8 @@ def whichToShrink(storage, intf):
actions.append(ActionResizeDevice(request, newSize))
except ValueError as e:
intf.messageWindow(_("Resize Device Error"),
- _("%s: %s") % (request.name, e.message,),
+ _("%(name)s: %(msg)s")
+ % {'name': request.name, 'msg': e.message},
type="warning", custom_icon="error")
continue
diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 292a485fd..b481c40fb 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -170,9 +170,11 @@ class VolumeGroupEditor:
self.intf.messageWindow(_("Not enough space"),
_("The physical extent size cannot be "
"changed because the value selected "
- "(%10.2f MB) is larger than the smallest "
- "physical volume (%10.2f MB) in the "
- "volume group.") % (curpe, maxpvsize),
+ "(%(curpe)10.2f MB) is larger than the "
+ "smallest physical volume "
+ "(%(maxpvsize)10.2f MB) in the volume "
+ "group.") % {'curpe': curpe,
+ 'maxpvsize': maxpvsize},
custom_icon="error")
widget.set_active(lastidx)
return 0
@@ -182,12 +184,12 @@ class VolumeGroupEditor:
self.intf.messageWindow(_("Not enough space"),
_("The physical extent size cannot be "
"changed because the value selected "
- "(%10.2f MB) is too large compared "
- "to the size of the "
+ "(%(curpe)10.2f MB) is too large "
+ "compared to the size of the "
"smallest physical volume "
- "(%10.2f MB) in the "
- "volume group.") % (curpe,
- maxpvsize),
+ "(%(maxpvsize)10.2f MB) in the "
+ "volume group.")
+ % {'curpe': curpe, 'maxpvsize': maxpvsize},
custom_icon="error")
widget.set_active(lastidx)
return 0
@@ -676,13 +678,14 @@ class VolumeGroupEditor:
if size > maxlv:
self.intf.messageWindow(_("Not enough space"),
_("The current requested size "
- "(%10.2f MB) is larger than the maximum "
- "logical volume size (%10.2f MB). "
+ "(%(size)10.2f MB) is larger than "
+ "the maximum logical volume size "
+ "(%(maxlv)10.2f MB). "
"To increase this limit you can "
"create more Physical Volumes from "
"unpartitioned disk space and "
"add them to this Volume Group.")
- %(size, maxlv),
+ % {'size': size, 'maxlv': maxlv},
custom_icon="error")
continue
@@ -696,11 +699,14 @@ class VolumeGroupEditor:
except ValueError:
self.intf.messageWindow(_("Not enough space"),
_("The logical volumes you have "
- "configured require %d MB, but the "
- "volume group only has %d MB. Please "
- "either make the volume group larger "
- "or make the logical volume(s) smaller.")
- % (size, tempvg.size),
+ "configured require %(size)d MB,"
+ " but the volume group only has "
+ "%(tempvgsize)d MB. Please "
+ "either make the volume group "
+ "larger or make the logical "
+ "volume(s) smaller.")
+ % {'size': size,
+ 'tempvgsize': tempvg.size},
custom_icon="error")
continue
diff --git a/iw/netconfig_dialog.py b/iw/netconfig_dialog.py
index cdcad5ef0..336cf0e3e 100644
--- a/iw/netconfig_dialog.py
+++ b/iw/netconfig_dialog.py
@@ -190,7 +190,8 @@ class NetworkConfigurator:
d = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR,
gtk.BUTTONS_OK,
_("An error occurred converting the value "
- "entered for \"%s\":\n%s") %(field, errmsg))
+ "entered for \"%(field)s\":\n%(errmsg)s")
+ % {'field': field, 'errmsg': errmsg})
d.set_title(_("Error With Data"))
d.set_position(gtk.WIN_POS_CENTER)
gui.addFrame(d)
diff --git a/iw/network_gui.py b/iw/network_gui.py
index 2ba129557..c3086d563 100644
--- a/iw/network_gui.py
+++ b/iw/network_gui.py
@@ -71,9 +71,11 @@ class NetworkWindow(InstallWindow):
if herrors is not None:
self.intf.messageWindow(_("Error with Hostname"),
- _("The hostname \"%s\" is not valid for the "
- "following reason:\n\n%s")
- % (hostname, herrors,),
+ _("The hostname \"%(hostname)s\" is not "
+ "valid for the following reason:\n\n"
+ "%(herrors)s")
+ % {'hostname': hostname,
+ 'herrors': herrors},
custom_icon="error")
self.hostnameError()
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 9762041d0..b0c846d35 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -334,8 +334,10 @@ class DiskStripeGraph(StripeGraph):
def _createStripe(self, drive):
# Create the stripe
- drivetext = _("Drive %s (%-0.f MB) (Model: %s)") % (drive.path,
- drive.size, drive.model)
+ drivetext = _("Drive %(drive)s (%(size)-0.f MB) (Model: %(model)s)") \
+ % {'drive': drive.path,
+ 'size': drive.size,
+ 'model': drive.model}
stripe = Stripe(self.getCanvas(), drivetext, self.editCB, obj = drive)
# Free Extended Calculation
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 11c9eb0da..0910a97cc 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -656,14 +656,14 @@ class RaidCloneDialog:
rc = self.storage.deviceImmutable(req)
if rc:
self.intf.messageWindow(_("Target Drive Error"),
- _("The target drive %s "
+ _("The target drive %(path)s "
"has a partition which cannot "
"be removed for the following "
- "reason:\n\n\"%s\"\n\n"
+ "reason:\n\n\"%(rc)s\"\n\n"
"You must remove this partition "
"before "
"this drive can be a target.") %
- (targetDev.path, rc),
+ {'path': targetDev.path, 'rc': rc},
custom_icon="error")
return 1
diff --git a/iw/task_gui.py b/iw/task_gui.py
index 9006d44b5..85e659a29 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -81,8 +81,9 @@ def setupBaseRepo(anaconda, methodstr):
except SystemError as e:
anaconda.intf.messageWindow(_("Error Setting Up Repository"),
_("The following error occurred while setting up the "
- "installation repository:\n\n%s\n\nPlease provide the "
- "correct information for installing %s") % (e, productName))
+ "installation repository:\n\n%(e)s\n\nPlease provide the "
+ "correct information for installing %(productName)s")
+ % {'e': e, 'productName': productName})
return False
anaconda.backend.ayum.configBaseRepo(replace=True)
diff --git a/iw/upgrade_bootloader_gui.py b/iw/upgrade_bootloader_gui.py
index f35ce0a98..72e0ec297 100644
--- a/iw/upgrade_bootloader_gui.py
+++ b/iw/upgrade_bootloader_gui.py
@@ -135,9 +135,9 @@ class UpgradeBootloaderWindow (InstallWindow):
self.update_label.set_sensitive(False)
update = 0
else:
- current = _("The installer has detected the %s boot loader "
- "currently installed on %s.") % (self.type,
- self.bootDev)
+ current = _("The installer has detected the %(type)s boot loader "
+ "currently installed on %(bootDev)s.") \
+ % {'type': self.type, 'bootDev': self.bootDev}
self.update_label = gtk.Label("%s %s" % (updatestr,
_("This is the recommended option.")))
self.update_radio.set_active(False)
diff --git a/iw/upgrade_migratefs_gui.py b/iw/upgrade_migratefs_gui.py
index 8a3ac96f1..622c21cb4 100644
--- a/iw/upgrade_migratefs_gui.py
+++ b/iw/upgrade_migratefs_gui.py
@@ -66,13 +66,13 @@ class UpgradeMigrateFSWindow (InstallWindow):
box = gtk.VBox (False, 5)
box.set_border_width (5)
- text = (_("This release of %s supports "
+ text = (_("This release of %(productName)s supports "
"an updated file system, which has several "
"benefits over the file system traditionally shipped "
- "in %s. This installation program can migrate "
+ "in %(productName)s. This installation program can migrate "
"formatted partitions without data loss.\n\n"
"Which of these partitions would you like to migrate?") %
- (productName, productName))
+ {'productName': productName})
label = gtk.Label (text)
label.set_alignment (0.5, 0.0)
diff --git a/kickstart.py b/kickstart.py
index 57f7aa3a5..b06a28b9c 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -95,10 +95,11 @@ class AnacondaKSScript(Script):
if intf != None:
err = None
msg = _("There was an error running the kickstart "
- "script at line %s. You may examine the "
- "output in %s. This is a fatal error and "
+ "script at line %(lineno)s. You may examine the "
+ "output in %(msgs)s. This is a fatal error and "
"installation will be aborted. Press the "
- "OK button to exit the installer.") % (self.lineno, messages)
+ "OK button to exit the installer.") \
+ % {'lineno': self.lineno, 'msgs': messages}
if self.logfile is not None and os.path.isfile(messages):
try:
diff --git a/packages.py b/packages.py
index 074f753a4..bd9445ecc 100644
--- a/packages.py
+++ b/packages.py
@@ -345,7 +345,7 @@ def betaNagScreen(anaconda):
while 1:
rc = anaconda.intf.messageWindow( _("Warning! This is pre-release software!"),
_("Thank you for downloading this "
- "pre-release of %s.\n\n"
+ "pre-release of %(productName)s.\n\n"
"This is not a final "
"release and is not intended for use "
"on production systems. The purpose of "
@@ -353,9 +353,11 @@ def betaNagScreen(anaconda):
"from testers, and it is not suitable "
"for day to day usage.\n\n"
"To report feedback, please visit:\n\n"
- " %s\n\n"
- "and file a report against '%s'.\n")
- %(productName, bugzillaUrl, fileagainst),
+ " %(bugzillaUrl)s\n\n"
+ "and file a report against '%(fileagainst)s'.\n")
+ % {'productName': productName,
+ 'bugzillaUrl': bugzillaUrl,
+ 'fileagainst': fileagainst},
type="custom", custom_icon="warning",
custom_buttons=[_("_Exit"), _("_Install anyway")])
diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index a8cde971d..08c7ce99f 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -260,8 +260,10 @@ def partitionSanityErrors(intf, errors):
"scheme. "
"These errors must be corrected prior "
"to continuing with your install of "
- "%s.\n\n%s") %(productName, errorstr),
- custom_icon="error")
+ "%(productName)s.\n\n%(errorstr)s") \
+ % {'productName': productName,
+ 'errorstr': errorstr},
+ custom_icon="error")
return rc
def partitionSanityWarnings(intf, warnings):
@@ -332,8 +334,8 @@ def confirmDelete(intf, device):
% device.path)
else:
# we may want something a little bit prettier than device.type
- errmsg = (_("You are about to delete the %s %s") % (device.type,
- device.name))
+ errmsg = (_("You are about to delete the %(type)s %(name)s") \
+ % {'type': device.type, 'name': device.name})
rc = intf.messageWindow(_("Confirm Delete"), errmsg, type="custom",
custom_buttons=[_("Cancel"), _("_Delete")],
diff --git a/rescue.py b/rescue.py
index b6e6c10a8..775f159e8 100644
--- a/rescue.py
+++ b/rescue.py
@@ -354,12 +354,12 @@ def runRescue(anaconda, instClass):
log.info("System has been mounted under: %s" % anaconda.rootPath)
else:
ButtonChoiceWindow(screen, _("Rescue"),
- _("Your system has been mounted under %s.\n\n"
+ _("Your system has been mounted under %(rootPath)s.\n\n"
"Press <return> to get a shell. If you would like to "
"make your system the root environment, run the command:\n\n"
- "\tchroot %s\n\nThe system will reboot "
+ "\tchroot %(rootPath)s\n\nThe system will reboot "
"automatically when you exit from the shell.") %
- (anaconda.rootPath, anaconda.rootPath),
+ {'rootPath': anaconda.rootPath},
[_("OK")] )
rootmounted = 1
diff --git a/storage/__init__.py b/storage/__init__.py
index c87bbfbcb..ef39277f5 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -869,11 +869,11 @@ class Storage(object):
if (root and
root.size < self.anaconda.backend.getMinimumSizeMB("/")):
- errors.append(_("Your / partition is less than %s "
+ errors.append(_("Your / partition is less than %(min)s "
"MB which is lower than recommended "
- "for a normal %s install.")
- %(self.anaconda.backend.getMinimumSizeMB("/"),
- productName))
+ "for a normal %(productName)s install.")
+ % {'min': self.anaconda.backend.getMinimumSizeMB("/"),
+ 'productName': productName})
# livecds have to have the rootfs type match up
if (root and
@@ -886,10 +886,12 @@ class Storage(object):
for (mount, size) in checkSizes:
if mount in filesystems and filesystems[mount].size < size:
- warnings.append(_("Your %s partition is less than %s "
- "megabytes which is lower than recommended "
- "for a normal %s install.")
- %(mount, size, productName))
+ warnings.append(_("Your %(mount)s partition is less than "
+ "%(size)s megabytes which is lower than "
+ "recommended for a normal %(productName)s "
+ "install.")
+ % {'mount': mount, 'size': size,
+ 'productName': productName})
usb_disks = []
firewire_disks = []
@@ -1707,17 +1709,19 @@ class FSSet(object):
except DeviceError as (msg, name):
if anaconda.intf:
if upgrading:
- err = _("Error enabling swap device %s: %s\n\n"
+ err = _("Error enabling swap device %(name)s: "
+ "%(msg)s\n\n"
"The /etc/fstab on your upgrade partition "
"does not reference a valid swap "
"device.\n\nPress OK to exit the "
- "installer") % (name, msg)
+ "installer") % {'name': name, 'msg': msg}
else:
- err = _("Error enabling swap device %s: %s\n\n"
+ err = _("Error enabling swap device %(name)s: "
+ "%(msg)s\n\n"
"This most likely means this swap "
"device has not been initialized.\n\n"
"Press OK to exit the installer.") % \
- (name, msg)
+ {'name': name, 'msg': msg}
anaconda.intf.messageWindow(_("Error"), err)
sys.exit(0)
@@ -1783,27 +1787,30 @@ class FSSet(object):
"installer.")
% (device.format.mountpoint,))
else:
+ na = {'mountpoint': device.format.mountpoint,
+ 'msg': e.strerror}
intf.messageWindow(_("Invalid mount point"),
_("An error occurred when trying "
- "to create %s: %s. This is "
+ "to create %(mountpoint)s: "
+ "%(msg)s. This is "
"a fatal error and the install "
"cannot continue.\n\n"
"Press <Enter> to exit the "
- "installer.")
- % (device.format.mountpoint, e.strerror))
+ "installer.") % na)
log.error("OSError: (%d) %s" % (e.errno, e.strerror))
sys.exit(0)
except SystemError as (num, msg):
if raiseErrors:
raise
if intf and not device.format.linuxNative:
+ na = {'path': device.path,
+ 'mountpoint': device.format.mountpoint}
ret = intf.messageWindow(_("Unable to mount filesystem"),
_("An error occurred mounting "
- "device %s as %s. You may "
+ "device %(path)s as "
+ "%(mountpoint)s. You may "
"continue installation, but "
- "there may be problems.") %
- (device.path,
- device.format.mountpoint),
+ "there may be problems.") % na,
type="custom",
custom_icon="warning",
custom_buttons=[_("_Exit installer"),
@@ -1818,16 +1825,17 @@ class FSSet(object):
sys.exit(0)
except FSError as msg:
if intf:
+ na = {'path': device.path,
+ 'mountpoint': device.format.mountpoint,
+ 'msg': msg}
intf.messageWindow(_("Unable to mount filesystem"),
_("An error occurred mounting "
- "device %s as %s: %s. This is "
+ "device %(path)s as %(mountpoint)s: "
+ "%(msg)s. This is "
"a fatal error and the install "
"cannot continue.\n\n"
"Press <Enter> to exit the "
- "installer.")
- % (device.path,
- device.format.mountpoint,
- msg))
+ "installer.") % na)
log.error("FSError: %s" % msg)
sys.exit(0)
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 6a4f0da8c..a9b74ebad 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -143,10 +143,11 @@ def questionInitializeDisk(intf=None, path=None, description=None):
rc = intf.messageWindow(_("Warning"),
_("Error processing drive:\n\n"
- "%s\n%-0.fMB\n%s\n\n"
+ "%(path)s\n%(size)-0.fMB\n%(description)s\n\n"
"This device may need to be reinitialized.\n\n"
- "REINITIALIZING WILL CAUSE ALL DATA TO BE LOST!%s")
- % (path, dev.getSize(), description, details,),
+ "REINITIALIZING WILL CAUSE ALL DATA TO BE LOST!%(details)s")
+ % {'path': path, 'size': dev.getSize(),
+ 'description': description, 'details': details},
type="custom",
custom_buttons = [ _("_Ignore drive"),
_("_Re-initialize drive") ],
@@ -167,12 +168,13 @@ def questionReinitILVM(intf=None, pv_names=None, lv_name=None, vg_name=None):
elif lv_name is not None:
message = "Logical Volume %s" % lv_name
-
+ na = {'msg': message, 'pvs': ", ".join(pv_names)}
rc = intf.messageWindow(_("Warning"),
_("Error processing LVM.\n"
- "There is inconsistent LVM data on %s. You can reinitialize "
- "all related PVs (%s) which will erase the LVM metadata, or "
- "ignore which will preserve the contents." % (message, ", ".join(pv_names))),
+ "There is inconsistent LVM data on %(msg)s. You can "
+ "reinitialize all related PVs (%(pvs)s) which will erase "
+ "the LVM metadata, or ignore which will preserve the "
+ "contents.") % na,
type="custom",
custom_buttons = [ _("_Ignore"),
_("_Re-initialize") ],
diff --git a/storage/partitioning.py b/storage/partitioning.py
index 20ed61ba6..464c9b6c6 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -230,7 +230,8 @@ def doAutoPartition(anaconda):
extra = _("\n\nPress 'OK' to exit the installer.")
anaconda.intf.messageWindow(_("Error Partitioning"),
_("Could not allocate requested partitions: \n\n"
- "%s.%s") % (msg, extra), custom_icon='error')
+ "%(msg)s.%(extra)s") % {'msg': msg, 'extra': extra},
+ custom_icon='error')
if anaconda.isKickstart:
sys.exit(0)
@@ -253,11 +254,11 @@ def doAutoPartition(anaconda):
anaconda.intf.messageWindow(_("Automatic Partitioning Errors"),
_("The following errors occurred with your "
- "partitioning:\n\n%s\n\n"
+ "partitioning:\n\n%(errortxt)s\n\n"
"This can happen if there is not enough "
"space on your hard drive(s) for the "
- "installation. %s")
- % (errortxt, extra),
+ "installation. %(extra)s")
+ % {'errortxt': errortxt, 'extra': extra},
custom_icon='error')
#
# XXX if in kickstart we reboot
diff --git a/storage/zfcp.py b/storage/zfcp.py
index 25f90b9cc..47271b96e 100644
--- a/storage/zfcp.py
+++ b/storage/zfcp.py
@@ -128,9 +128,9 @@ class ZFCPDevice:
"free %s" %(self.devnum,))
udev_settle()
except IOError as e:
- raise ValueError, _(
- "Could not free zFCP device %s from device ignore list (%s)."
- %(self.devnum, e))
+ raise ValueError, _("Could not free zFCP device %(devnum)s from "
+ "device ignore list (%(e)s).") \
+ % {'devnum': self.devnum, 'e': e}
if not os.path.exists(online):
raise ValueError, _(
@@ -146,9 +146,9 @@ class ZFCPDevice:
else:
log.info("zFCP device %s already online." %(self.devnum,))
except IOError as e:
- raise ValueError, _(
- "Could not set zFCP device %s online (%s)."
- %(self.devnum, e))
+ raise ValueError, _("Could not set zFCP device %(devnum)s "
+ "online (%(e)s).") \
+ % {'devnum': self.devnum, 'e': e}
if not os.path.exists(portdir):
if os.path.exists(portadd):
@@ -157,31 +157,39 @@ class ZFCPDevice:
loggedWriteLineToFile(portadd, self.wwpn)
udev_settle()
except IOError as e:
- raise ValueError, _(
- "Could not add WWPN %s to zFCP device %s (%s)."
- %(self.wwpn, self.devnum, e))
+ raise ValueError, _("Could not add WWPN %(wwpn)s to zFCP "
+ "device %(devnum)s (%(e)s).") \
+ % {'wwpn': self.wwpn,
+ 'devnum': self.devnum,
+ 'e': e}
else:
# newer zfcp sysfs interface with auto port scan
- raise ValueError, _("WWPN %s not found at zFCP device %s."
- %(self.wwpn, self.devnum))
+ raise ValueError, _("WWPN %(wwpn)s not found at zFCP device "
+ "%(devnum)s.") % {'wwpn': self.wwpn,
+ 'devnum': self.devnum}
else:
if os.path.exists(portadd):
# older zfcp sysfs interface
- log.info("WWPN %s at zFCP device %s already there."
- %(self.wwpn, self.devnum))
+ log.info("WWPN %(wwpn)s at zFCP device %(devnum)s already "
+ "there.") % {'wwpn': self.wwpn,
+ 'devnum': self.devnum}
if not os.path.exists(unitdir):
try:
loggedWriteLineToFile(unitadd, self.fcplun)
udev_settle()
except IOError as e:
- raise ValueError, _(
- "Could not add LUN %s to WWPN %s on zFCP device %s (%s)."
- %(self.fcplun, self.wwpn, self.devnum, e))
+ raise ValueError, _("Could not add LUN %(fcplun)s to WWPN "
+ "%(wwpn)s on zFCP device %(devnum)s "
+ "(%(e)s).") \
+ % {'fcplun': self.fcplun, 'wwpn': self.wwpn,
+ 'devnum': self.devnum, 'e': e}
else:
- raise ValueError, _(
- "LUN %s at WWPN %s on zFCP device %s already configured."
- %(self.fcplun, self.wwpn, self.devnum))
+ raise ValueError, _("LUN %(fcplun)s at WWPN %(wwpn)s on zFCP "
+ "device %(devnum)s already configured.") \
+ % {'fcplun': self.fcplun,
+ 'wwpn': self.wwpn,
+ 'devnum': self.devnum}
fail = "0"
try:
@@ -189,14 +197,20 @@ class ZFCPDevice:
fail = f.readline().strip()
f.close()
except IOError as e:
- raise ValueError, _(
- "Could not read failed attribute of LUN %s at WWPN %s on zFCP device %s (%s)."
- %(self.fcplun, self.wwpn, self.devnum, e))
+ raise ValueError, _("Could not read failed attribute of LUN "
+ "%(fcplun)s at WWPN %(wwpn)s on zFCP device "
+ "%(devnum)s (%(e)s).") \
+ % {'fcplun': self.fcplun,
+ 'wwpn': self.wwpn,
+ 'devnum': self.devnum,
+ 'e': e}
if fail != "0":
self.offlineDevice()
- raise ValueError, _(
- "Failed LUN %s at WWPN %s on zFCP device %s removed again."
- %(self.fcplun, self.wwpn, self.devnum))
+ raise ValueError, _("Failed LUN %(fcplun)s at WWPN %(wwpn)s on "
+ "zFCP device %(devnum)s removed again.") \
+ % {'fcplun': self.fcplun,
+ 'wwpn': self.wwpn,
+ 'devnum': self.devnum}
return True
@@ -249,16 +263,20 @@ class ZFCPDevice:
try:
self.offlineSCSIDevice()
except IOError as e:
- raise ValueError, _(
- "Could not correctly delete SCSI device of zFCP %s %s %s (%s)."
- %(self.devnum, self.wwpn, self.fcplun, e))
+ raise ValueError, _("Could not correctly delete SCSI device of "
+ "zFCP %(devnum)s %(wwpn)s %(fcplun)s "
+ "(%(e)s).") \
+ % {'devnum': self.devnum, 'wwpn': self.wwpn,
+ 'fcplun': self.fcplun, 'e': e}
try:
loggedWriteLineToFile(unitremove, self.fcplun)
except IOError as e:
- raise ValueError, _(
- "Could not remove LUN %s at WWPN %s on zFCP device %s (%s)."
- %(self.fcplun, self.wwpn, self.devnum, e))
+ raise ValueError, _("Could not remove LUN %(fcplun)s at WWPN "
+ "%(wwpn)s on zFCP device %(devnum)s "
+ "(%(e)s).") \
+ % {'fcplun': self.fcplun, 'wwpn': self.wwpn,
+ 'devnum': self.devnum, 'e': e}
if os.path.exists(portadd):
# only try to remove ports with older zfcp sysfs interface
@@ -272,8 +290,10 @@ class ZFCPDevice:
try:
loggedWriteLineToFile(portremove, self.wwpn)
except IOError as e:
- raise ValueError, _("Could not remove WWPN %s on zFCP device %s (%s)."
- %(self.wwpn, self.devnum, e))
+ raise ValueError, _("Could not remove WWPN %(wwpn)s on zFCP "
+ "device %(devnum)s (%(e)s).") \
+ % {'wwpn': self.wwpn,
+ 'devnum': self.devnum, 'e': e}
if os.path.exists(portadd):
# older zfcp sysfs interface
@@ -296,8 +316,9 @@ class ZFCPDevice:
try:
loggedWriteLineToFile(offline, "0")
except IOError as e:
- raise ValueError, _("Could not set zFCP device %s offline (%s)."
- %(self.devnum, e))
+ raise ValueError, _("Could not set zFCP device %(devnum)s "
+ "offline (%(e)s).") \
+ % {'devnum': self.devnum, 'e': e}
return True
diff --git a/text.py b/text.py
index 6ca7d82a6..aeaa5858d 100644
--- a/text.py
+++ b/text.py
@@ -372,7 +372,7 @@ class InstallInterface:
def drawFrame(self):
self.screen.drawRootText (0, 0, self.screen.width * " ")
if productArch:
- self.screen.drawRootText (0, 0, _("Welcome to %s for %s") % (productName, productArch,))
+ self.screen.drawRootText (0, 0, _("Welcome to %(productName)s for %(productArch)s") % {'productName': productName, 'productArch': productArch})
else:
self.screen.drawRootText (0, 0, _("Welcome to %s") % productName)
diff --git a/textw/netconfig_text.py b/textw/netconfig_text.py
index 8698f85cf..986db2dd6 100644
--- a/textw/netconfig_text.py
+++ b/textw/netconfig_text.py
@@ -34,7 +34,9 @@ class NetworkConfiguratorText:
def _handleIPError(self, field, errmsg):
self.anaconda.intf.messageWindow(_("Error With Data"),
_("An error occurred converting the "
- "value entered for \"%s\":\n%s") % (field, errmsg))
+ "value entered for "
+ "\"%(field)s\":\n%(errmsg)s") \
+ % {'field': field, 'errmsg': errmsg})
def _handleIPMissing(self, field):
self.anaconda.intf.messageWindow(_("Error With Data"),
diff --git a/textw/upgrade_bootloader_text.py b/textw/upgrade_bootloader_text.py
index 20afec62a..89e5b438e 100644
--- a/textw/upgrade_bootloader_text.py
+++ b/textw/upgrade_bootloader_text.py
@@ -118,9 +118,10 @@ class UpgradeBootloaderWindow:
self.update_radio.w.checkboxSetFlags(FLAG_DISABLED, FLAGS_SET)
else:
t = TextboxReflowed(53,
- _("The installer has detected the %s boot "
- "loader currently installed on %s.")
- % (self.type, self.bootDev))
+ _("The installer has detected the %(type)s "
+ "boot loader currently installed on "
+ "%(bootDev)s.")
+ % {'type': self.type, 'bootDev': self.bootDev})
self.update_radio = blradio.add(_("Update boot loader configuration"),
"update", update)
diff --git a/textw/upgrade_text.py b/textw/upgrade_text.py
index 77993bb59..0d2fc031c 100644
--- a/textw/upgrade_text.py
+++ b/textw/upgrade_text.py
@@ -35,13 +35,13 @@ class UpgradeMigrateFSWindow:
g = GridFormHelp(screen, _("Migrate File Systems"), "upmigfs", 1, 4)
- text = (_("This release of %s supports "
+ text = (_("This release of %(productName)s supports "
"the an updated file system, which has several "
"benefits over the file system traditionally shipped "
- "in %s. This installation program can migrate "
+ "in %(productName)s. This installation program can migrate "
"formatted partitions without data loss.\n\n"
"Which of these partitions would you like to migrate?") %
- (productName, productName))
+ {'productName': productName})
tb = TextboxReflowed(60, text)
g.add(tb, 0, 0, anchorLeft = 1, padding = (0, 0, 0, 1))
diff --git a/vnc.py b/vnc.py
index db119d096..0a6a04933 100644
--- a/vnc.py
+++ b/vnc.py
@@ -134,9 +134,15 @@ class VncServer:
# figure out product info
if self.name is not None:
- self.desktop = _("%s %s installation on host %s") % (product.productName, product.productVersion, self.name)
+ self.desktop = _("%(productName)s %(productVersion)s installation "
+ "on host %(name)s") \
+ % {'productName': product.productName,
+ 'productVersion': product.productVersion,
+ 'name': self.name}
else:
- self.desktop = _("%s %s installation") % (product.productName, product.productVersion)
+ self.desktop = _("%(productName)s %(productVersion)s installation")\
+ % {'productName': product.productName,
+ 'productVersion': product.productVersion}
def setVNCParam(self, param, value):
"""Set a parameter in the Xvnc server.
diff --git a/yuminstall.py b/yuminstall.py
index bad27e5a0..5a116f5c9 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -158,7 +158,8 @@ class AnacondaCallback:
repo = self.repos.getRepo(po.repoid)
pkgStr = "%s-%s-%s.%s" % (po.name, po.version, po.release, po.arch)
- s = to_unicode(_("<b>Installing %s</b> (%s)\n")) %(pkgStr, size_string(hdr['size']))
+ s = to_unicode(_("<b>Installing %(pkgStr)s</b> (%(size)s)\n")) \
+ % {'pkgStr': pkgStr, 'size': size_string(hdr['size'])}
summary = to_unicode(gettext.ldgettext("redhat-dist", hdr['summary'] or ""))
s += summary.strip()
self.progress.set_label(s)
@@ -206,10 +207,13 @@ class AnacondaCallback:
self.doneFiles += len(hdr[rpm.RPMTAG_BASENAMES])
if self.donepkgs <= self.numpkgs:
- self.progress.set_text(P_("Packages completed: %d of %d",
- "Packages completed: %d of %d",
+ self.progress.set_text(N_("Packages completed: "
+ "%(donepkgs)d of %(numpkgs)d",
+ "Packages completed: "
+ "%(donepkgs)d of %(numpkgs)d",
self.numpkgs)
- % (self.donepkgs, self.numpkgs,))
+ % {'donepkgs': self.donepkgs,
+ 'numpkgs': self.numpkgs})
self.progress.set_fraction(float(self.doneSize / self.totalSize))
self.progress.processEvents()
@@ -303,8 +307,9 @@ class AnacondaYum(YumSorter):
except SystemError, e:
self.anaconda.intf.messageWindow(_("Error Setting Up Repository"),
_("The following error occurred while setting up the "
- "installation repository:\n\n%s\n\nPlease provide the "
- "correct information for installing %s.") % (e, productName))
+ "installation repository:\n\n%(e)s\n\nPlease provide the "
+ "correct information for installing %(productName)s.")
+ % {'e': e, 'productName': productName})
self.anaconda.methodstr = self.anaconda.intf.methodstrRepoWindow()
@@ -362,8 +367,8 @@ class AnacondaYum(YumSorter):
self.anaconda.intf.beep()
self.anaconda.intf.messageWindow(_("Change Disc"),
- _("Please insert %s disc %d to continue.") % (productName,
- discnum))
+ _("Please insert %(productName)s disc %(discnum)d to continue.")
+ % {'productName': productName, 'discnum': discnum})
try:
dev.format.mount()
@@ -1570,14 +1575,16 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
log.info("po.arch is arch: %s" %(po.arch,))
if not compareArch(po.arch, myarch):
rc = anaconda.intf.messageWindow(_("Warning"),
- _("The arch of the release of %s you "
- "are upgrading to appears to be %s "
- "which does not match your previously "
- "installed arch of %s. This is likely "
- "to not succeed. Are you sure you "
- "wish to continue the upgrade process?")
- %(productName, myarch, po.arch),
- type="yesno")
+ _("The arch of the release of %(productName)s you "
+ "are upgrading to appears to be %(myarch)s which "
+ "does not match your previously installed arch of "
+ "%(arch)s. This is likely to not succeed. Are "
+ "you sure you wish to continue the upgrade "
+ "process?")
+ % {'productName': productName,
+ 'myarch': myarch,
+ 'arch': po.arch},
+ type="yesno")
if rc == 0:
iutil.resetRpmDb(anaconda.rootPath)
sys.exit(0)