[virt-tools-list] [PATCH virt-manager] translation: fix wrong usage of _() function
Pavel Hrdina
phrdina at redhat.com
Tue Jun 2 12:21:58 UTC 2015
All the strings have to be at first translated and then we can fill the
formated and translated string.
Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
virt-install | 2 +-
virt-xml | 4 ++--
virtManager/addhardware.py | 2 +-
virtManager/createnet.py | 2 +-
virtManager/details.py | 4 ++--
virtManager/engine.py | 2 +-
virtManager/migrate.py | 2 +-
virtManager/snapshots.py | 2 +-
virtconv/ovf.py | 2 +-
virtinst/cli.py | 6 +++---
virtinst/interface.py | 4 ++--
virtinst/storage.py | 10 +++++-----
12 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/virt-install b/virt-install
index f64bd96..6894654 100755
--- a/virt-install
+++ b/virt-install
@@ -397,7 +397,7 @@ def set_install_media(guest, location, cdpath, distro_variant):
elif distro_variant != "none":
guest.os_variant = distro_variant
except ValueError, e:
- fail(_("Error validating install location: %s" % str(e)))
+ fail(_("Error validating install location: %s") % str(e))
def do_test_media_detection(conn, url):
diff --git a/virt-xml b/virt-xml
index 1b25007..744af3d 100755
--- a/virt-xml
+++ b/virt-xml
@@ -249,7 +249,7 @@ def setup_device(dev):
def define_changes(conn, inactive_xmlobj, devs, action, confirm):
if confirm:
if not prompt_yes_or_no(
- _("Define '%s' with the changed XML?" % inactive_xmlobj.name)):
+ _("Define '%s' with the changed XML?") % inactive_xmlobj.name):
return
if action == "hotplug":
@@ -257,7 +257,7 @@ def define_changes(conn, inactive_xmlobj, devs, action, confirm):
setup_device(dev)
conn.defineXML(inactive_xmlobj.get_xml_config())
- print_stdout(_("Domain '%s' defined successfully." % inactive_xmlobj.name))
+ print_stdout(_("Domain '%s' defined successfully.") % inactive_xmlobj.name)
def update_changes(domain, devs, action, confirm):
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 8b1736b..7607529 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -1381,7 +1381,7 @@ class vmmAddHardware(vmmGObjectUI):
self.vm.add_device(controller)
self.vm.add_device(self._dev)
except Exception, e:
- self.err.show_err(_("Error adding device: %s" % str(e)))
+ self.err.show_err(_("Error adding device: %s") % str(e))
return True
return False
diff --git a/virtManager/createnet.py b/virtManager/createnet.py
index 4b53389..d35d7ea 100644
--- a/virtManager/createnet.py
+++ b/virtManager/createnet.py
@@ -752,7 +752,7 @@ class vmmCreateNetwork(vmmGObjectUI):
try:
net = self._build_xmlobj()
except Exception, e:
- self.err.show_err(_("Error generating network xml: %s" % str(e)))
+ self.err.show_err(_("Error generating network xml: %s") % str(e))
return
self.topwin.set_sensitive(False)
diff --git a/virtManager/details.py b/virtManager/details.py
index d28bfdd..718f50a 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -236,7 +236,7 @@ def _label_for_device(dev, vm):
if devtype == "hostdev":
return dev.pretty_name()
if devtype == "sound":
- return _("Sound: %s" % dev.model)
+ return _("Sound: %s") % dev.model
if devtype == "video":
return _("Video %s") % dev.pretty_model(dev.model)
if devtype == "filesystem":
@@ -2356,7 +2356,7 @@ class vmmDetails(vmmGObjectUI):
try:
self.vm.remove_device(devobj)
except Exception, e:
- self.err.show_err(_("Error Removing Device: %s" % str(e)))
+ self.err.show_err(_("Error Removing Device: %s") % str(e))
return
# Try to hot remove
diff --git a/virtManager/engine.py b/virtManager/engine.py
index b2bbc8e..722a1b5 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -958,7 +958,7 @@ class vmmEngine(vmmGObject):
if not src.err.chkbox_helper(self.config.get_confirm_poweroff,
self.config.set_confirm_poweroff,
- text1=_("Are you sure you want to save '%s'?" % vm.get_name())):
+ text1=_("Are you sure you want to save '%s'?") % vm.get_name()):
return
_cancel_cb = None
diff --git a/virtManager/migrate.py b/virtManager/migrate.py
index 4141cbf..ca430dd 100644
--- a/virtManager/migrate.py
+++ b/virtManager/migrate.py
@@ -400,7 +400,7 @@ class vmmMigrateDialog(vmmGObjectUI):
self._async_migrate,
[self.vm, destconn, uri, tunnel, unsafe, temporary],
self._finish_cb, [destconn],
- _("Migrating VM '%s'" % self.vm.get_name()),
+ _("Migrating VM '%s'") % self.vm.get_name(),
(_("Migrating VM '%s' to %s. This may take a while.") %
(self.vm.get_name(), destlabel)),
self.topwin, cancel_cb=cancel_cb)
diff --git a/virtManager/snapshots.py b/virtManager/snapshots.py
index 4acc19f..288ef83 100644
--- a/virtManager/snapshots.py
+++ b/virtManager/snapshots.py
@@ -484,7 +484,7 @@ class vmmSnapshotPage(vmmGObjectUI):
newsnap.get_xml_config()
return newsnap
except Exception, e:
- return self.err.val_err(_("Error validating snapshot: %s" % e))
+ return self.err.val_err(_("Error validating snapshot: %s") % e)
def _get_screenshot_data_for_save(self):
snwidget = self.widget("snapshot-new-screenshot")
diff --git a/virtconv/ovf.py b/virtconv/ovf.py
index 7eaf094..fa657d4 100644
--- a/virtconv/ovf.py
+++ b/virtconv/ovf.py
@@ -199,7 +199,7 @@ def _import_file(doc, ctx, conn, input_file):
ref = _path_has_prefix("/file/")
else:
- raise ValueError(_("Unknown storage path type %s." % path))
+ raise ValueError(_("Unknown storage path type %s.") % path)
xpath = (envbase + "/ovf:References/ovf:File[@ovf:id='%s']" % ref)
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 2c5a002..457368d 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -360,7 +360,7 @@ def validate_disk(dev, warn_overwrite=False):
if not VirtualDisk.path_definitely_exists(dev.conn, dev.path):
return
_optional_fail(
- _("This will overwrite the existing path '%s'" % dev.path),
+ _("This will overwrite the existing path '%s'") % dev.path,
"path_exists")
def check_inuse_conflict(dev):
@@ -1641,7 +1641,7 @@ class ParserDisk(VirtCLIParser):
try:
return float(val)
except Exception, e:
- fail(_("Improper value for 'size': %s" % str(e)))
+ fail(_("Improper value for 'size': %s") % str(e))
def convert_perms(val):
if val is None:
@@ -1654,7 +1654,7 @@ class ParserDisk(VirtCLIParser):
# It's default. Nothing to do.
pass
else:
- fail(_("Unknown '%s' value '%s'" % ("perms", val)))
+ fail(_("Unknown '%s' value '%s'") % ("perms", val))
has_path = "path" in opts.opts
backing_store = opts.get_opt_param("backing_store")
diff --git a/virtinst/interface.py b/virtinst/interface.py
index 0857895..d7b25e7 100644
--- a/virtinst/interface.py
+++ b/virtinst/interface.py
@@ -254,14 +254,14 @@ class Interface(XMLBuilder):
try:
iface = self.conn.interfaceDefineXML(xml, 0)
except Exception, e:
- raise RuntimeError(_("Could not define interface: %s" % str(e)))
+ raise RuntimeError(_("Could not define interface: %s") % str(e))
errmsg = None
if create and not errmsg:
try:
iface.create(0)
except Exception, e:
- errmsg = _("Could not create interface: %s" % str(e))
+ errmsg = _("Could not create interface: %s") % str(e)
if errmsg:
# Try and clean up the leftover pool
diff --git a/virtinst/storage.py b/virtinst/storage.py
index 3102bf6..9e90db8 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -502,26 +502,26 @@ class StoragePool(_StorageObject):
try:
pool = self.conn.storagePoolDefineXML(xml, 0)
except Exception, e:
- raise RuntimeError(_("Could not define storage pool: %s" % str(e)))
+ raise RuntimeError(_("Could not define storage pool: %s") % str(e))
errmsg = None
if build:
try:
pool.build(libvirt.VIR_STORAGE_POOL_BUILD_NEW)
except Exception, e:
- errmsg = _("Could not build storage pool: %s" % str(e))
+ errmsg = _("Could not build storage pool: %s") % str(e)
if create and not errmsg:
try:
pool.create(0)
except Exception, e:
- errmsg = _("Could not start storage pool: %s" % str(e))
+ errmsg = _("Could not start storage pool: %s") % str(e)
if autostart and not errmsg:
try:
pool.setAutostart(True)
except Exception, e:
- errmsg = _("Could not set pool autostart flag: %s" % str(e))
+ errmsg = _("Could not set pool autostart flag: %s") % str(e)
if errmsg:
# Try and clean up the leftover pool
@@ -590,7 +590,7 @@ class StorageVolume(_StorageObject):
return self._pool
def _set_pool(self, newpool):
if newpool.info()[0] != libvirt.VIR_STORAGE_POOL_RUNNING:
- raise ValueError(_("pool '%s' must be active." % newpool.name()))
+ raise ValueError(_("pool '%s' must be active.") % newpool.name())
self._pool = newpool
self._pool_xml = StoragePool(self.conn,
parsexml=self._pool.XMLDesc(0))
--
2.3.6
More information about the virt-tools-list
mailing list