i18n: use single strings for network list in clone dialog

Create single strings for the networks in the clone dialog, including
all the available information at once instead of join pieces together.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
Pino Toscano 2020-07-14 09:41:50 +02:00 committed by Cole Robinson
parent 71f034d6b6
commit 6a39f2bb8b

View File

@ -287,7 +287,7 @@ class vmmCloneVM(vmmGObjectUI):
def build_net_row(labelstr, origmac, newmac): def build_net_row(labelstr, origmac, newmac):
label = Gtk.Label(label=labelstr + " (%s)" % origmac) label = Gtk.Label(label=labelstr)
label.set_alignment(0, .5) label.set_alignment(0, .5)
button = Gtk.Button(_("Details...")) button = Gtk.Button(_("Details..."))
button.connect("clicked", self.net_change_mac, origmac) button.connect("clicked", self.net_change_mac, origmac)
@ -317,7 +317,7 @@ class vmmCloneVM(vmmGObjectUI):
# [ interface type, device name, origmac, newmac, label ] # [ interface type, device name, origmac, newmac, label ]
if net_type == DeviceInterface.TYPE_USER: if net_type == DeviceInterface.TYPE_USER:
label = _("Usermode") label = _("Usermode (%(mac)s)") % {"mac": mac}
elif net_type == DeviceInterface.TYPE_VIRTUAL: elif net_type == DeviceInterface.TYPE_VIRTUAL:
net = None net = None
@ -327,19 +327,32 @@ class vmmCloneVM(vmmGObjectUI):
break break
if net: if net:
label = "" label = _("%(netmode)s (%(mac)s)") % {
"netmode": net.pretty_forward_mode(),
desc = net.pretty_forward_mode() "mac": mac,
label += "%s" % desc }
elif net_dev:
label = _("Virtual Network %(netdevice)s (%(mac)s)") % {
"netdevice": net_dev,
"mac": mac,
}
else: else:
label = (_("Virtual Network") + label = _("Virtual Network (%(mac)s)") % {"mac": mac}
(net_dev and " %s" % net_dev or ""))
else: else:
# 'bridge' or anything else # 'bridge' or anything else
label = (net_type.capitalize() + pretty_net_type = net_type.capitalize()
(net_dev and (" %s" % net_dev) or "")) if net_dev:
label = _("%(nettype)s %(netdevice)s (%(mac)s)") % {
"nettype": pretty_net_type,
"netdevice": net_dev,
"mac": mac,
}
else:
label = _("%(nettype)s (%(mac)s)") % {
"nettype": pretty_net_type,
"mac": mac,
}
build_net_row(label, mac, newmac) build_net_row(label, mac, newmac)