i18n: create single strings for texts/messages

Use single strings with proper placeholders for texts, so there is no
need to join together bits of translated texts.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
Pino Toscano 2020-07-15 14:48:57 +02:00 committed by Cole Robinson
parent 392caac8b4
commit 2760b20c84
4 changed files with 24 additions and 23 deletions

View File

@ -50,7 +50,7 @@ class Snapshots(uiutils.UITestCase):
snaprun.click()
alert = self.app.root.find_fuzzy("vmm dialog", "alert")
alert.find_fuzzy(
"sure you want to run snapshot '%s'" % snapname, "label")
"sure you want to run the snapshot '%s'" % snapname, "label")
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: vmrun.sensitive)
@ -60,7 +60,7 @@ class Snapshots(uiutils.UITestCase):
snaprun.click()
alert = self.app.root.find_fuzzy("vmm dialog", "alert")
alert.find_fuzzy(
"sure you want to run snapshot '%s'" % snapname, "label")
"sure you want to run the snapshot '%s'" % snapname, "label")
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: vmpause.checked)

View File

@ -1740,14 +1740,9 @@ class vmmCreateVM(vmmGObjectUI):
if nettype is None:
# No network device available
instmethod = self._get_config_install_page()
methname = None
if instmethod == INSTALL_PAGE_URL:
methname = "URL"
if methname:
return self.err.val_err(
_("Network device required for %s install.") %
methname)
_("Network device required for URL install."))
macaddr = virtinst.DeviceInterface.generate_mac(
self.conn.get_backend())

View File

@ -453,15 +453,18 @@ class vmmSnapshotPage(vmmGObjectUI):
if snap.is_external():
has_external = True
sortname = "3%s" % name
external = " (%s)" % _("External")
label = _("%(vm)s\n<span size='small'>VM State: "
"%(state)s (External)</span>")
else:
has_internal = True
external = ""
sortname = "1%s" % name
label = _("%(vm)s\n<span size='small'>VM State: "
"%(state)s</span>")
label = "%s\n<span size='small'>%s: %s%s</span>" % (
(xmlutil.xml_escape(name), _("VM State"),
xmlutil.xml_escape(state), external))
label = label % {
"vm": xmlutil.xml_escape(name),
"state": xmlutil.xml_escape(state)
}
model.append([name, label, desc, snap.run_status_icon_name(),
sortname, snap.is_current()])
@ -652,14 +655,15 @@ class vmmSnapshotPage(vmmGObjectUI):
snap = snaps[0]
label = _("disk")
if not self.vm.is_active():
label = _("disk and configuration")
msg = (_("Are you sure you want to run snapshot '%(name)s'? "
"All %(changetype)s changes since the last snapshot was "
"created will be discarded.") %
{"name": snap.get_name(), "changetype": label})
if self.vm.is_active():
msg = _("Are you sure you want to run the snapshot '%(name)s'? "
"All the disk changes since the last snapshot was created "
"will be discarded.")
else:
msg = _("Are you sure you want to run the snapshot '%(name)s'? "
"All the disk and configuration changes since the last "
"snapshot was created will be discarded.")
msg = msg % {"name": snap.get_name()}
result = self.err.yes_no(msg)
if not result:

View File

@ -160,8 +160,10 @@ class Cloner(object):
except Exception as e:
log.debug("Error setting clone path.", exc_info=True)
raise ValueError(
(_("Could not use path '%s' for cloning") % path) +
(": " + str(e)))
_("Could not use path '%(path)s' for cloning: %(error)s") % {
"path": path,
"error": str(e),
})
self._clone_disks = disklist
def get_clone_paths(self):