mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-08 21:18:04 +03:00
translation: fix wrong usage of _() function
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@redhat.com>
This commit is contained in:
parent
03c24ca5cb
commit
0fbe8e7a1f
@ -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):
|
||||
|
4
virt-xml
4
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):
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user