i18n: fix string puzzles in error messages
Do not split the error messages and the error details, but rather use a single string with proper placeholders. This avoids string puzzles. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
parent
ed836c7138
commit
71f034d6b6
|
@ -806,10 +806,12 @@ class vmmCloneVM(vmmGObjectUI):
|
|||
self.reset_finish_cursor()
|
||||
|
||||
if error is not None:
|
||||
msg = (_("Error creating virtual machine clone '%s'") %
|
||||
self.clone_design.clone_name)
|
||||
msg += ": %s" % error
|
||||
self.err.show_err(msg, details=details)
|
||||
error = (_("Error creating virtual machine clone '%(vm)s': "
|
||||
"%(error)s") % {
|
||||
"vm": self.clone_design.clone_name,
|
||||
"error": error,
|
||||
})
|
||||
self.err.show_err(error, details=details)
|
||||
return
|
||||
|
||||
conn.schedule_priority_tick(pollvm=True)
|
||||
|
|
|
@ -598,11 +598,16 @@ class vmmConnection(vmmGObject):
|
|||
except Exception as fixerr:
|
||||
log.debug("Failed to redefine original %s!",
|
||||
obj.class_name(), exc_info=True)
|
||||
msg = (_("%s rename failed. Attempting to "
|
||||
"recover also failed") % (obj.class_name()))
|
||||
msg += "\n\n"
|
||||
msg += ("Original error: %s\n\n" % str(renameerr))
|
||||
msg += ("Recover error: %s" % str(fixerr))
|
||||
msg = _("%(object)s rename failed. Attempting to recover also "
|
||||
"failed.\n"
|
||||
"\n"
|
||||
"Original error: %(origerror)s\n"
|
||||
"\n"
|
||||
"Recover error: %s") % {
|
||||
"object": obj.class_name(),
|
||||
"origerror": str(renameerr),
|
||||
"recovererror": str(fixerr),
|
||||
}
|
||||
raise RuntimeError(msg)
|
||||
raise
|
||||
finally:
|
||||
|
|
|
@ -1923,7 +1923,7 @@ class vmmCreateVM(vmmGObjectUI):
|
|||
self._show_customize_dialog(guest, installer)
|
||||
except Exception as e:
|
||||
self.reset_finish_cursor()
|
||||
self.err.show_err(_("Error starting installation: ") + str(e))
|
||||
self.err.show_err(_("Error starting installation: %s") % str(e))
|
||||
return
|
||||
|
||||
def _cleanup_customize_window(self):
|
||||
|
|
|
@ -199,9 +199,10 @@ class _vmmDeleteBase(vmmGObjectUI):
|
|||
|
||||
self._delete_vm(vm)
|
||||
except Exception as e:
|
||||
error = (
|
||||
(_("Error deleting virtual machine '%s'") % vm.get_name()) +
|
||||
(": %s") % str(e))
|
||||
error = _("Error deleting virtual machine '%(vm)s': %(error)s") % {
|
||||
"vm": vm.get_name(),
|
||||
"error": str(e),
|
||||
}
|
||||
details = "".join(traceback.format_exc())
|
||||
|
||||
storage_errstr = ""
|
||||
|
|
|
@ -736,7 +736,7 @@ class vmmConsolePages(vmmGObjectUI):
|
|||
except Exception as e:
|
||||
log.exception("Error connection to graphical console")
|
||||
self._activate_unavailable_page(
|
||||
_("Error connecting to graphical console") + ":\n%s" % e)
|
||||
_("Error connecting to graphical console:\n%s") % e)
|
||||
|
||||
def _set_credentials(self, src_ignore=None):
|
||||
passwd = self.widget("console-auth-password")
|
||||
|
|
|
@ -461,8 +461,10 @@ class VNCViewer(Viewer):
|
|||
self._sockfd = sock
|
||||
except Exception as e:
|
||||
raise RuntimeError(
|
||||
(_("Error opening socket path '%s'") % self._ginfo.gsocket) +
|
||||
(": %s" % e))
|
||||
_("Error opening socket path '%(path)s': %(error)s") % {
|
||||
"path": self._ginfo.gsocket,
|
||||
"error": e,
|
||||
})
|
||||
|
||||
fd = self._sockfd.fileno()
|
||||
if fd < 0:
|
||||
|
|
|
@ -211,8 +211,10 @@ class vmmNetworkList(vmmGObjectUI):
|
|||
log.debug("Started network '%s'", devname)
|
||||
except Exception as e:
|
||||
return self.err.show_err(
|
||||
(_("Could not start virtual network '%s'") % devname) +
|
||||
(": %s") % str(e))
|
||||
_("Could not start virtual network '%(device)s': %(error)s") % {
|
||||
"device": devname,
|
||||
"error": str(e),
|
||||
})
|
||||
|
||||
def _find_rowiter_for_dev(self, net):
|
||||
nettype = net.type
|
||||
|
|
|
@ -239,7 +239,7 @@ class VMActionUI(object):
|
|||
def errorcb(error, details):
|
||||
# This is run from the main thread
|
||||
res = src.err.show_err(
|
||||
_("Error restoring domain") + ": " + error,
|
||||
_("Error restoring domain: %s") % error,
|
||||
details=details,
|
||||
text2=_(
|
||||
"The domain could not be restored. Would you like\n"
|
||||
|
|
|
@ -489,8 +489,10 @@ def get_domain_and_guest(conn, domstr):
|
|||
else:
|
||||
raise
|
||||
except libvirt.libvirtError as e:
|
||||
fail((_("Could not find domain '%s'") % domstr) +
|
||||
(": " + str(e)))
|
||||
fail(_("Could not find domain '%(domain)s': %(error)s") % {
|
||||
"domain": domstr,
|
||||
"error": str(e),
|
||||
})
|
||||
|
||||
state = domain.info()[0]
|
||||
active_xmlobj = None
|
||||
|
|
|
@ -43,8 +43,10 @@ def _replace_vm(conn, name):
|
|||
vm.undefine()
|
||||
except libvirt.libvirtError as e: # pragma: no cover
|
||||
raise RuntimeError(
|
||||
(_("Could not remove old vm '%s'") % name) +
|
||||
(": " + str(e)))
|
||||
_("Could not remove old vm '%(vm)s': %(error)s") % {
|
||||
"vm": name,
|
||||
"error": str(e),
|
||||
})
|
||||
|
||||
|
||||
class Cloner(object):
|
||||
|
|
|
@ -623,10 +623,10 @@ class CloneStorageCreator(_StorageCreator):
|
|||
meter.update(i)
|
||||
except OSError as e: # pragma: no cover
|
||||
msg = (_("Error cloning diskimage "
|
||||
"%(inputpath)s to %(outputpath)s") %
|
||||
"%(inputpath)s to %(outputpath)s: %(error)s") %
|
||||
{"inputpath": self._input_path,
|
||||
"outputpath": self._output_path})
|
||||
msg += ": " + str(e)
|
||||
"outputpath": self._output_path,
|
||||
"error": str(e)})
|
||||
raise RuntimeError(msg)
|
||||
finally:
|
||||
if src_fd is not None:
|
||||
|
|
|
@ -68,8 +68,10 @@ class InstallerTreeMedia(object):
|
|||
"from the local directory mount point.")
|
||||
|
||||
raise ValueError(
|
||||
(_("Validating install media '%s' failed") % str(path)) +
|
||||
(": %s" % e))
|
||||
_("Validating install media '%(media)s' failed: %(error)s") % {
|
||||
"media": str(path),
|
||||
"error": str(e),
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
def get_system_scratchdir(guest):
|
||||
|
|
|
@ -68,8 +68,10 @@ class _URLFetcher(object):
|
|||
urlobj, size = self._grabber(url)
|
||||
except Exception as e:
|
||||
raise ValueError(
|
||||
(_("Couldn't acquire file %s") % url) +
|
||||
(": %s" % str(e)))
|
||||
_("Couldn't acquire file %(url)s: %(error)s") % {
|
||||
"url": url,
|
||||
"error": str(e),
|
||||
})
|
||||
|
||||
log.debug("Fetching URI: %s", url)
|
||||
self.meter.start(
|
||||
|
@ -246,8 +248,10 @@ class _FTPURLFetcher(_URLFetcher):
|
|||
self._ftp.voidcmd("TYPE I")
|
||||
except Exception as e: # pragma: no cover
|
||||
raise ValueError(
|
||||
(_("Opening URL %s failed") % self.location) +
|
||||
(": %s" % str(e)))
|
||||
_("Opening URL %(url)s failed: %(error)s") % {
|
||||
"url": self.location,
|
||||
"error": str(e),
|
||||
})
|
||||
|
||||
def _grabber(self, url):
|
||||
"""
|
||||
|
|
|
@ -163,8 +163,10 @@ class StoragePool(_StorageObject):
|
|||
return defpool
|
||||
except Exception as e: # pragma: no cover
|
||||
raise RuntimeError(
|
||||
(_("Couldn't create default storage pool '%s'") % path) +
|
||||
(": %s" % str(e)))
|
||||
_("Couldn't create default storage pool '%(path)s': %(error)s") % {
|
||||
"path": path,
|
||||
"error": str(e),
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
def lookup_pool_by_path(conn, path):
|
||||
|
|
|
@ -243,8 +243,10 @@ def start_domain_transient(conn, xmlobj, devs, action, confirm):
|
|||
try:
|
||||
dom = conn.createXML(xmlobj.get_xml())
|
||||
except libvirt.libvirtError as e:
|
||||
fail((_("Failed starting domain '%s'") % xmlobj.name) +
|
||||
(": %s" % e))
|
||||
fail(_("Failed starting domain '%(domain)s': %(error)s") % {
|
||||
"vm": xmlobj.name,
|
||||
"error": e,
|
||||
})
|
||||
else:
|
||||
print_stdout(_("Domain '%s' started successfully.") % xmlobj.name)
|
||||
return dom
|
||||
|
@ -278,8 +280,10 @@ def update_changes(domain, devs, action, confirm):
|
|||
elif action == "update":
|
||||
domain.updateDeviceFlags(xml, libvirt.VIR_DOMAIN_AFFECT_LIVE)
|
||||
except libvirt.libvirtError as e:
|
||||
fail((_("Error attempting device action %s") % action) +
|
||||
(": %s" % e))
|
||||
fail(_("Error attempting device action %(action)s: %(error)s") % {
|
||||
"action": action,
|
||||
"error": e,
|
||||
})
|
||||
|
||||
# Test driver doesn't support device hotplug so we can't reach this
|
||||
print_stdout(_("Device %s successful.") % action) # pragma: no cover
|
||||
|
@ -505,8 +509,10 @@ def main(conn=None):
|
|||
try:
|
||||
dom.create()
|
||||
except libvirt.libvirtError as e: # pragma: no cover
|
||||
fail((_("Failed starting domain '%s'") % inactive_xmlobj.name) +
|
||||
(": " % e))
|
||||
fail(_("Failed starting domain '%(domain)s': %(error)s") % {
|
||||
"domain": inactive_xmlobj.name,
|
||||
"error": e,
|
||||
})
|
||||
print_stdout(_("Domain '%s' started successfully.") %
|
||||
inactive_xmlobj.name)
|
||||
|
||||
|
|
Loading…
Reference in New Issue