diff options
author | Pino Toscano <ptoscano@redhat.com> | 2020-07-14 09:41:49 +0200 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2020-07-14 11:23:57 -0400 |
commit | 71f034d6b6aad1c8d08b6e95496327299fe797e9 (patch) | |
tree | a75feeeafb6409a10d80ae60b898d236d693da96 /virtManager | |
parent | ed836c713846a0993e5ea39e1f8c5f336fd74679 (diff) | |
download | virt-manager-71f034d6b6aad1c8d08b6e95496327299fe797e9.tar.gz |
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>
Diffstat (limited to 'virtManager')
-rw-r--r-- | virtManager/clone.py | 10 | ||||
-rw-r--r-- | virtManager/connection.py | 15 | ||||
-rw-r--r-- | virtManager/createvm.py | 2 | ||||
-rw-r--r-- | virtManager/delete.py | 7 | ||||
-rw-r--r-- | virtManager/details/console.py | 2 | ||||
-rw-r--r-- | virtManager/details/viewers.py | 6 | ||||
-rw-r--r-- | virtManager/device/netlist.py | 6 | ||||
-rw-r--r-- | virtManager/vmmenu.py | 2 |
8 files changed, 31 insertions, 19 deletions
diff --git a/virtManager/clone.py b/virtManager/clone.py index ecd56b5d..43a04802 100644 --- a/virtManager/clone.py +++ b/virtManager/clone.py @@ -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) diff --git a/virtManager/connection.py b/virtManager/connection.py index bed6f5d5..01d5e03a 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -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: diff --git a/virtManager/createvm.py b/virtManager/createvm.py index 5f15f5c3..1120ea2a 100644 --- a/virtManager/createvm.py +++ b/virtManager/createvm.py @@ -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): diff --git a/virtManager/delete.py b/virtManager/delete.py index 40284505..28edc727 100644 --- a/virtManager/delete.py +++ b/virtManager/delete.py @@ -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 = "" diff --git a/virtManager/details/console.py b/virtManager/details/console.py index 193e79eb..ae9b85ed 100644 --- a/virtManager/details/console.py +++ b/virtManager/details/console.py @@ -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") diff --git a/virtManager/details/viewers.py b/virtManager/details/viewers.py index bcefa86a..4ae0e668 100644 --- a/virtManager/details/viewers.py +++ b/virtManager/details/viewers.py @@ -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: diff --git a/virtManager/device/netlist.py b/virtManager/device/netlist.py index 29aeac50..cfd7a442 100644 --- a/virtManager/device/netlist.py +++ b/virtManager/device/netlist.py @@ -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 diff --git a/virtManager/vmmenu.py b/virtManager/vmmenu.py index a5b4410f..5883ce34 100644 --- a/virtManager/vmmenu.py +++ b/virtManager/vmmenu.py @@ -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" |