[virt-tools-list] [virt-manager PATCH v2] localization: mark several strings as translatable

Pavel Hrdina phrdina at redhat.com
Fri Feb 5 16:45:13 UTC 2016


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 virtManager/addhardware.py     | 52 +++++++++++++++++++++---------------------
 virtManager/connect.py         |  6 ++---
 virtManager/connectauth.py     |  2 +-
 virtManager/connection.py      |  2 +-
 virtManager/console.py         |  4 ++--
 virtManager/createinterface.py | 24 +++++++++----------
 virtManager/details.py         | 14 ++++++------
 virtManager/error.py           |  2 +-
 virtManager/gfxdetails.py      |  4 ++--
 virtManager/host.py            | 14 ++++++------
 virtManager/interface.py       |  4 ++--
 virtManager/libvirtobject.py   |  4 ++--
 virtManager/netlist.py         |  6 ++---
 virtManager/preferences.py     |  2 +-
 virtManager/storagelist.py     | 10 ++++----
 virtinst/cloner.py             |  4 ++--
 virtinst/devicedisk.py         |  4 ++--
 virtinst/devicehostdev.py      |  2 +-
 virtinst/devicerng.py          |  4 ++--
 virtinst/network.py            |  5 ++--
 virtinst/seclabel.py           |  4 ++--
 21 files changed, 87 insertions(+), 86 deletions(-)

diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index d3a69c3..a2c2830 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -177,7 +177,7 @@ class vmmAddHardware(vmmGObjectUI):
         hw_list = self.widget("hw-list")
         hw_list.set_model(model)
 
-        hw_col = Gtk.TreeViewColumn("Hardware")
+        hw_col = Gtk.TreeViewColumn(_("Hardware"))
         hw_col.set_spacing(6)
         hw_col.set_min_width(165)
 
@@ -347,32 +347,32 @@ class vmmAddHardware(vmmGObjectUI):
         def add_hw_option(name, icon, page, sensitive, errortxt, devtype=None):
             model.append([name, icon, page, sensitive, errortxt, devtype])
 
-        add_hw_option("Storage", "drive-harddisk", PAGE_DISK, have_storage,
+        add_hw_option(_("Storage"), "drive-harddisk", PAGE_DISK, have_storage,
                       have_storage and storage_tooltip or None)
-        add_hw_option("Controller", "device_pci", PAGE_CONTROLLER, True, None)
-        add_hw_option("Network", "network-idle", PAGE_NETWORK, True, None)
-        add_hw_option("Input", "input-mouse", PAGE_INPUT, self.vm.is_hvm(),
+        add_hw_option(_("Controller"), "device_pci", PAGE_CONTROLLER, True, None)
+        add_hw_option(_("Network"), "network-idle", PAGE_NETWORK, True, None)
+        add_hw_option(_("Input"), "input-mouse", PAGE_INPUT, self.vm.is_hvm(),
                       _("Not supported for this guest type."))
-        add_hw_option("Graphics", "video-display", PAGE_GRAPHICS,
+        add_hw_option(_("Graphics"), "video-display", PAGE_GRAPHICS,
                       True, None)
-        add_hw_option("Sound", "audio-card", PAGE_SOUND,
+        add_hw_option(_("Sound"), "audio-card", PAGE_SOUND,
                       self.vm.is_hvm(),
                       _("Not supported for this guest type."))
-        add_hw_option("Serial", Gtk.STOCK_CONNECT, PAGE_CHAR,
+        add_hw_option(_("Serial"), Gtk.STOCK_CONNECT, PAGE_CHAR,
                       self.vm.is_hvm(),
                       _("Not supported for this guest type."),
                       "serial")
-        add_hw_option("Parallel", Gtk.STOCK_CONNECT, PAGE_CHAR,
+        add_hw_option(_("Parallel"), Gtk.STOCK_CONNECT, PAGE_CHAR,
                       self.vm.is_hvm(),
                       _("Not supported for this guest type."),
                       "parallel")
-        add_hw_option("Console", Gtk.STOCK_CONNECT, PAGE_CHAR,
+        add_hw_option(_("Console"), Gtk.STOCK_CONNECT, PAGE_CHAR,
                       True, None, "console")
-        add_hw_option("Channel", Gtk.STOCK_CONNECT, PAGE_CHAR,
+        add_hw_option(_("Channel"), Gtk.STOCK_CONNECT, PAGE_CHAR,
                       self.vm.is_hvm(),
                       _("Not supported for this guest type."),
                       "channel")
-        add_hw_option("USB Host Device", "system-run", PAGE_HOSTDEV,
+        add_hw_option(_("USB Host Device"), "system-run", PAGE_HOSTDEV,
                       self.conn.is_nodedev_capable(),
                       _("Connection does not support host device enumeration"),
                       "usb")
@@ -383,28 +383,28 @@ class vmmAddHardware(vmmGObjectUI):
         if self.vm.is_container():
             nodedev_enabled = False
             nodedev_errstr = _("Not supported for containers")
-        add_hw_option("PCI Host Device", "system-run", PAGE_HOSTDEV,
+        add_hw_option("PCI Host Device"), "system-run", PAGE_HOSTDEV,
                       nodedev_enabled, nodedev_errstr, "pci")
 
-        add_hw_option("Video", "video-display", PAGE_VIDEO, True,
+        add_hw_option(_("Video"), "video-display", PAGE_VIDEO, True,
                       _("Libvirt version does not support video devices."))
-        add_hw_option("Watchdog", "device_pci", PAGE_WATCHDOG,
+        add_hw_option(_("Watchdog"), "device_pci", PAGE_WATCHDOG,
                       self.vm.is_hvm(),
                       _("Not supported for this guest type."))
-        add_hw_option("Filesystem", "folder", PAGE_FILESYSTEM,
+        add_hw_option(_("Filesystem"), "folder", PAGE_FILESYSTEM,
                       self.conn.check_support(
                         self.conn.SUPPORT_CONN_FILESYSTEM) and
                       not self.vm.stable_defaults(),
                       _("Not supported for this hypervisor/libvirt "
                         "combination."))
-        add_hw_option("Smartcard", "device_serial", PAGE_SMARTCARD,
+        add_hw_option(_("Smartcard"), "device_serial", PAGE_SMARTCARD,
                       True, None)
-        add_hw_option("USB Redirection", "device_usb", PAGE_USBREDIR,
+        add_hw_option(_("USB Redirection"), "device_usb", PAGE_USBREDIR,
                       True, None)
-        add_hw_option("TPM", "device_cpu", PAGE_TPM,
+        add_hw_option(_("TPM"), "device_cpu", PAGE_TPM,
                       True, None)
-        add_hw_option("RNG", "system-run", PAGE_RNG, True, None)
-        add_hw_option("Panic Notifier", "system-run", PAGE_PANIC,
+        add_hw_option(_("RNG"), "system-run", PAGE_RNG, True, None)
+        add_hw_option(_("Panic Notifier"), "system-run", PAGE_PANIC,
             self.conn.check_support(self.conn.SUPPORT_CONN_PANIC_DEVICE),
             _("Not supported for this hypervisor/libvirt combination."))
 
@@ -600,8 +600,8 @@ class vmmAddHardware(vmmGObjectUI):
         model.clear()
 
         # [xml value, label]
-        model.append(["passthrough", "Passthrough"])
-        model.append(["host", "Host"])
+        model.append(["passthrough", _("Passthrough")])
+        model.append(["host", _("Host")])
 
     @staticmethod
     def build_smartcard_mode_combo(vm, combo):
@@ -628,7 +628,7 @@ class vmmAddHardware(vmmGObjectUI):
         model.clear()
 
         # [xml value, label, conn details]
-        model.append(["spicevmc", "Spice channel", False])
+        model.append(["spicevmc", _("Spice channel"), False])
         model.append(["tcp", "TCP", True])
 
     @staticmethod
@@ -714,7 +714,7 @@ class vmmAddHardware(vmmGObjectUI):
             if not vm.get_xmlobj().os.is_q35():
                 rows.append(["ide", "IDE"])
             rows.append(["sata", "SATA"])
-            rows.append(["fdc", "Floppy"])
+            rows.append(["fdc", _("Floppy")])
 
             if not vm.stable_defaults():
                 rows.append(["scsi", "SCSI"])
@@ -1117,7 +1117,7 @@ class vmmAddHardware(vmmGObjectUI):
 
         if page == PAGE_CHAR:
             char_class = self._get_char_class()
-            return char_class.virtual_device_type.capitalize() + " Device"
+            return _("%s Device") % char_class.virtual_device_type.capitalize()
         if page == PAGE_HOSTDEV:
             row = self._get_hw_selection()
             if row and row[5] == "pci":
diff --git a/virtManager/connect.py b/virtManager/connect.py
index 7878611..1b218e5 100644
--- a/virtManager/connect.py
+++ b/virtManager/connect.py
@@ -165,9 +165,9 @@ class vmmConnect(vmmGObjectUI):
                 model.append([rowid, label])
 
         _add_hv_row(HV_QEMU, "qemu", "QEMU/KVM")
-        _add_hv_row(HV_QEMU_SESSION, "qemu", "QEMU/KVM user session")
+        _add_hv_row(HV_QEMU_SESSION, "qemu", "QEMU/KVM " + _("user session"))
         _add_hv_row(HV_XEN, "xen", "Xen")
-        _add_hv_row(HV_LXC, "lxc", "LXC (Linux Containers)")
+        _add_hv_row(HV_LXC, "lxc", "LXC (" + _("Linux Containers") + ")")
         _add_hv_row(HV_BHYVE, "bhyve", "Bhyve")
         combo.set_model(model)
         uiutil.init_combo_text_column(combo, 1)
@@ -176,7 +176,7 @@ class vmmConnect(vmmGObjectUI):
         model = Gtk.ListStore(str)
         model.append(["SSH"])
         model.append(["TCP (SASL, Kerberos)"])
-        model.append(["SSL/TLS with certificates"])
+        model.append(["SSL/TLS " + _("with certificates)"])
         combo.set_model(model)
         uiutil.init_combo_text_column(combo, 0)
 
diff --git a/virtManager/connectauth.py b/virtManager/connectauth.py
index 03cd067..635fce7 100644
--- a/virtManager/connectauth.py
+++ b/virtManager/connectauth.py
@@ -81,7 +81,7 @@ def _creds_dialog_main(conn, creds):
     """
     from gi.repository import Gtk
 
-    dialog = Gtk.Dialog("Authentication required", None, 0,
+    dialog = Gtk.Dialog(_("Authentication required"), None, 0,
                         (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                          Gtk.STOCK_OK, Gtk.ResponseType.OK))
     label = []
diff --git a/virtManager/connection.py b/virtManager/connection.py
index bd604b9..ce0afbf 100644
--- a/virtManager/connection.py
+++ b/virtManager/connection.py
@@ -414,7 +414,7 @@ class vmmConnection(vmmGObject):
         ret = hv
 
         if is_session:
-            ret += " User session"
+            ret += " " + _("User session")
         elif (path and path != "/system" and os.path.basename(path)):
             # Used by test URIs to report what XML file they are using
             ret += " %s" % os.path.basename(path)
diff --git a/virtManager/console.py b/virtManager/console.py
index 217df3d..3a1338e 100644
--- a/virtManager/console.py
+++ b/virtManager/console.py
@@ -871,9 +871,9 @@ class vmmConsolePages(vmmGObjectUI):
 
         for dev in devs:
             if dev.virtual_device_type == "console":
-                label = "Text Console %d" % (dev.vmmindex + 1)
+                label = _("Text Console %d") % (dev.vmmindex + 1)
             else:
-                label = "Serial %d" % (dev.vmmindex + 1)
+                label = _("Serial %d") % (dev.vmmindex + 1)
 
             tooltip = vmmSerialConsole.can_connect(self.vm, dev)
             sensitive = not bool(tooltip)
diff --git a/virtManager/createinterface.py b/virtManager/createinterface.py
index 7be5800..a0aa4ff 100644
--- a/virtManager/createinterface.py
+++ b/virtManager/createinterface.py
@@ -294,16 +294,16 @@ class vmmCreateInterface(vmmGObjectUI):
         ip_mode.set_model(ip_model)
         uiutil.init_combo_text_column(ip_mode, 0)
         ip_model.insert(IP_DHCP, ["DHCP"])
-        ip_model.insert(IP_STATIC, ["Static"])
-        ip_model.insert(IP_NONE, ["No configuration"])
+        ip_model.insert(IP_STATIC, [_("Static")])
+        ip_model.insert(IP_NONE, [_("No configuration")])
 
         ip_mode = self.widget("ipv6-mode")
         ip_model = Gtk.ListStore(str)
         ip_mode.set_model(ip_model)
         uiutil.init_combo_text_column(ip_mode, 0)
         ip_model.insert(IP_DHCP, ["DHCP"])
-        ip_model.insert(IP_STATIC, ["Static"])
-        ip_model.insert(IP_NONE, ["No configuration"])
+        ip_model.insert(IP_STATIC, [_("Static")])
+        ip_model.insert(IP_NONE, [_("No configuration")])
 
         v6_addr = self.widget("ipv6-address-list")
         addr_model = Gtk.ListStore(str)
@@ -432,9 +432,9 @@ class vmmCreateInterface(vmmGObjectUI):
             # We only want configured (aka interface API) interfaces with
             # actually present <protocol> info
             if not is_defined or not iface_obj:
-                label += " (Not configured)"
+                label += " (" + _("Not configured") + ")"
             elif not iface_obj.get_protocol_xml():
-                label += " (No IP configuration)"
+                label += " (" + _("No IP configuration") + ")"
             else:
                 sensitive = True
 
@@ -449,7 +449,7 @@ class vmmCreateInterface(vmmGObjectUI):
             copy_model.append(row)
 
         if len(copy_model) == 0:
-            copy_model.append(["No child interfaces selected.", None, False])
+            copy_model.append([_("No child interfaces selected."), None, False])
 
         if not enable_copy:
             copy_model.clear()
@@ -721,7 +721,7 @@ class vmmCreateInterface(vmmGObjectUI):
 
         if is_manual:
             if ipv4:
-                label += "IPv4: %s" % (ipv4.dhcp and "DHCP" or "Static")
+                label += "IPv4: %s" % (ipv4.dhcp and "DHCP" or _("Static"))
 
             if ipv6:
                 if label:
@@ -730,22 +730,22 @@ class vmmCreateInterface(vmmGObjectUI):
 
                 mode_label = ""
                 if ipv6.autoconf and ipv6.dhcp:
-                    mode_label += "Autoconf "
+                    mode_label += _("Autoconf") + " "
 
                 if ipv6.dhcp:
                     mode_label += "DHCP"
 
                 if not mode_label:
-                    mode_label = "Static"
+                    mode_label = _("Static")
 
                 label += mode_label
 
         else:
             if name:
-                label = "Copy configuration from '%s'" % name
+                label = _("Copy configuration from '%s'") % name
 
         if not label:
-            label = "No configuration"
+            label = _("No configuration")
 
         self.widget("ip-config-label").set_text(label)
 
diff --git a/virtManager/details.py b/virtManager/details.py
index 3dbd82f..58c8f68 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -751,7 +751,7 @@ class vmmDetails(vmmGObjectUI):
         hw_list_model = Gtk.ListStore(str, str, int, int, object)
         self.widget("hw-list").set_model(hw_list_model)
 
-        hwCol = Gtk.TreeViewColumn("Hardware")
+        hwCol = Gtk.TreeViewColumn(_("Hardware"))
         hwCol.set_spacing(6)
         hwCol.set_min_width(165)
         hw_txt = Gtk.CellRendererText()
@@ -1496,7 +1496,7 @@ class vmmDetails(vmmGObjectUI):
 
         path = self.err.browse_local(
             self.vm.conn, _("Save Virtual Machine Screenshot"),
-            _type=("png", "PNG files"),
+            _type=("png", _("PNG files")),
             dialog_type=Gtk.FileChooserAction.SAVE,
             browse_reason=self.config.CONFIG_DIR_SCREENSHOT,
             default_name=default)
@@ -2884,7 +2884,7 @@ class vmmDetails(vmmGObjectUI):
         uiutil.set_grid_row_visible(
             self.widget("hostdev-rombar"), hostdev.type == "pci")
 
-        devlabel = "<b>Physical %s Device</b>" % hostdev.type.upper()
+        devlabel = "<b>" + _("Physical %s Device") + "</b>" % hostdev.type.upper()
         self.widget("hostdev-title").set_markup(devlabel)
         self.widget("hostdev-source").set_text(pretty_name)
         self.widget("hostdev-rombar").set_active(rom_bar)
@@ -3148,10 +3148,10 @@ class vmmDetails(vmmGObjectUI):
     def _make_boot_rows(self):
         if not self.vm.can_use_device_boot_order():
             return [
-                ["hd", "Hard Disk", "drive-harddisk", False, True],
-                ["cdrom", "CDROM", "media-optical", False, True],
-                ["network", "Network (PXE)", "network-idle", False, True],
-                ["fd", "Floppy", "media-floppy", False, True],
+                ["hd", _("Hard Disk"), "drive-harddisk", False, True],
+                ["cdrom", _("CDROM"), "media-optical", False, True],
+                ["network", _("Network (PXE)"), "network-idle", False, True],
+                ["fd", _("Floppy"), "media-floppy", False, True],
             ]
 
         ret = []
diff --git a/virtManager/error.py b/virtManager/error.py
index 5a838f7..af235be 100644
--- a/virtManager/error.py
+++ b/virtManager/error.py
@@ -134,7 +134,7 @@ class vmmErrorDialog(vmmGObject):
                               modal=modal)
 
     def val_err(self, text1, text2=None, title=_("Input Error"), modal=True):
-        logtext = "Validation Error: %s" % text1
+        logtext = _("Validation Error: %s") % text1
         if text2:
             logtext += " %s" % text2
 
diff --git a/virtManager/gfxdetails.py b/virtManager/gfxdetails.py
index 702c822..0ae76c9 100644
--- a/virtManager/gfxdetails.py
+++ b/virtManager/gfxdetails.py
@@ -91,9 +91,9 @@ class vmmGraphicsDetails(vmmGObjectUI):
         combo.set_model(model)
         uiutil.init_combo_text_column(combo, 1)
 
-        model.append(["auto", "Auto"])
+        model.append(["auto", _("Auto")])
         model.append([virtinst.VirtualGraphics.KEYMAP_LOCAL,
-                      "Copy local keymap"])
+                      _("Copy local keymap")])
         for k in virtinst.VirtualGraphics.valid_keymaps():
             model.append([k, k])
 
diff --git a/virtManager/host.py b/virtManager/host.py
index 3c4a1bd..00ba4d8 100644
--- a/virtManager/host.py
+++ b/virtManager/host.py
@@ -154,7 +154,7 @@ class vmmHost(vmmGObjectUI):
         sel = self.widget("net-list").get_selection()
         sel.set_select_function((lambda *x: self.confirm_changes()), None)
 
-        netCol = Gtk.TreeViewColumn("Networks")
+        netCol = Gtk.TreeViewColumn(_("Networks"))
         netCol.set_spacing(6)
         net_txt = Gtk.CellRendererText()
         net_img = Gtk.CellRendererPixbuf()
@@ -182,7 +182,7 @@ class vmmHost(vmmGObjectUI):
         sel = self.widget("interface-list").get_selection()
         sel.set_select_function((lambda *x: self.confirm_changes()), None)
 
-        interfaceCol = Gtk.TreeViewColumn("Interfaces")
+        interfaceCol = Gtk.TreeViewColumn(_("Interfaces"))
         interfaceCol.set_spacing(6)
         interface_txt = Gtk.CellRendererText()
         interface_img = Gtk.CellRendererPixbuf()
@@ -204,14 +204,14 @@ class vmmHost(vmmGObjectUI):
         childList = self.widget("interface-child-list")
         childList.set_model(childListModel)
 
-        childNameCol = Gtk.TreeViewColumn("Name")
+        childNameCol = Gtk.TreeViewColumn(_("Name"))
         child_txt1 = Gtk.CellRendererText()
         childNameCol.pack_start(child_txt1, True)
         childNameCol.add_attribute(child_txt1, 'text', 0)
         childNameCol.set_sort_column_id(0)
         childList.append_column(childNameCol)
 
-        childTypeCol = Gtk.TreeViewColumn("Interface Type")
+        childTypeCol = Gtk.TreeViewColumn(_("Interface Type"))
         child_txt2 = Gtk.CellRendererText()
         childTypeCol.pack_start(child_txt2, True)
         childTypeCol.add_attribute(child_txt2, 'text', 1)
@@ -874,7 +874,7 @@ class vmmHost(vmmGObjectUI):
         self.widget("interface-ipv6-expander").set_visible(bool(ipv6))
 
         if ipv4:
-            mode = ipv4[0] and "DHCP" or "Static"
+            mode = ipv4[0] and "DHCP" or _("Static")
             addr = ipv4[1] or "-"
             self.widget("interface-ipv4-mode").set_text(mode)
             self.widget("interface-ipv4-address").set_text(addr)
@@ -882,12 +882,12 @@ class vmmHost(vmmGObjectUI):
         if ipv6:
             mode = ""
             if ipv6[1]:
-                mode = "Autoconf "
+                mode = _("Autoconf") + " "
 
             if ipv6[0]:
                 mode += "DHCP"
             else:
-                mode = "Static"
+                mode = _("Static")
 
             addrstr = "-"
             if ipv6[2]:
diff --git a/virtManager/interface.py b/virtManager/interface.py
index dc6f4da..3af5974 100644
--- a/virtManager/interface.py
+++ b/virtManager/interface.py
@@ -98,7 +98,7 @@ class vmmInterface(vmmLibvirtObject):
         elif itype:
             return str(itype).capitalize()
         else:
-            return "Interface"
+            return _("Interface")
 
     def get_startmode(self):
         return self.get_xmlobj(inactive=True).start_mode or "none"
@@ -109,7 +109,7 @@ class vmmInterface(vmmLibvirtObject):
         self._redefine_xmlobj(xmlobj)
 
     def get_slaves(self):
-        return [[obj.name, obj.type or "Unknown"] for obj in
+        return [[obj.name, obj.type or _("Unknown")] for obj in
                 self.get_xmlobj().interfaces]
 
     def get_slave_names(self):
diff --git a/virtManager/libvirtobject.py b/virtManager/libvirtobject.py
index 8df1239..933a61f 100644
--- a/virtManager/libvirtobject.py
+++ b/virtManager/libvirtobject.py
@@ -211,8 +211,8 @@ class vmmLibvirtObject(vmmGObject):
 
     def run_status(self):
         if self.is_active():
-            return "Active"
-        return "Inactive"
+            return _("Active")
+        return _("Inactive")
 
     def _refresh_status(self, newstatus=None, cansignal=True):
         """
diff --git a/virtManager/netlist.py b/virtManager/netlist.py
index 013ee4e..0507203 100644
--- a/virtManager/netlist.py
+++ b/virtManager/netlist.py
@@ -90,10 +90,10 @@ class vmmNetworkList(vmmGObjectUI):
         combo.set_model(model)
         uiutil.init_combo_text_column(combo, 1)
 
-        model.append(["bridge", "Bridge"])
+        model.append(["bridge", _("Bridge")])
         model.append(["vepa", "VEPA"])
-        model.append(["private", "Private"])
-        model.append(["passthrough", "Passthrough"])
+        model.append(["private", _("Private")])
+        model.append(["passthrough", _("Passthrough")])
         combo.set_active(0)
 
         combo = self.widget("net-portgroup")
diff --git a/virtManager/preferences.py b/virtManager/preferences.py
index db20a8b..775bf9c 100644
--- a/virtManager/preferences.py
+++ b/virtManager/preferences.py
@@ -141,7 +141,7 @@ class vmmPreferences(vmmGObjectUI):
         model = Gtk.ListStore(str, str)
         for row in [["system", _("System default (%s)") %
                      self.config.default_add_spice_usbredir],
-                    ["yes", "Yes"], ["no", "No"]]:
+                    ["yes", _("Yes")], ["no", _("No")]]:
             model.append(row)
         combo.set_model(model)
         uiutil.init_combo_text_column(combo, 1)
diff --git a/virtManager/storagelist.py b/virtManager/storagelist.py
index f21926e..8a34e7f 100644
--- a/virtManager/storagelist.py
+++ b/virtManager/storagelist.py
@@ -178,7 +178,7 @@ class vmmStorageList(vmmGObjectUI):
         volListModel = Gtk.ListStore(str, str, str, str, str, str, bool)
         self.widget("vol-list").set_model(volListModel)
 
-        volCol = Gtk.TreeViewColumn("Volumes")
+        volCol = Gtk.TreeViewColumn(_("Volumes"))
         vol_txt1 = Gtk.CellRendererText()
         volCol.pack_start(vol_txt1, True)
         volCol.add_attribute(vol_txt1, 'text', VOL_COLUMN_NAME)
@@ -186,7 +186,7 @@ class vmmStorageList(vmmGObjectUI):
         volCol.set_sort_column_id(VOL_COLUMN_NAME)
         self.widget("vol-list").append_column(volCol)
 
-        volSizeCol = Gtk.TreeViewColumn("Size")
+        volSizeCol = Gtk.TreeViewColumn(_("Size"))
         vol_txt2 = Gtk.CellRendererText()
         volSizeCol.pack_start(vol_txt2, False)
         volSizeCol.add_attribute(vol_txt2, 'text', VOL_COLUMN_SIZESTR)
@@ -195,7 +195,7 @@ class vmmStorageList(vmmGObjectUI):
         self.widget("vol-list").append_column(volSizeCol)
         volListModel.set_sort_func(VOL_COLUMN_CAPACITY, self._cap_sort_func)
 
-        volFormatCol = Gtk.TreeViewColumn("Format")
+        volFormatCol = Gtk.TreeViewColumn(_("Format"))
         vol_txt3 = Gtk.CellRendererText()
         volFormatCol.pack_start(vol_txt3, False)
         volFormatCol.add_attribute(vol_txt3, 'text', VOL_COLUMN_FORMAT)
@@ -203,7 +203,7 @@ class vmmStorageList(vmmGObjectUI):
         volFormatCol.set_sort_column_id(VOL_COLUMN_FORMAT)
         self.widget("vol-list").append_column(volFormatCol)
 
-        volUseCol = Gtk.TreeViewColumn("Used By")
+        volUseCol = Gtk.TreeViewColumn(_("Used By"))
         vol_txt4 = Gtk.CellRendererText()
         volUseCol.pack_start(vol_txt4, False)
         volUseCol.add_attribute(vol_txt4, 'text', VOL_COLUMN_INUSEBY)
@@ -220,7 +220,7 @@ class vmmStorageList(vmmGObjectUI):
         poolListModel = Gtk.ListStore(str, str, bool, str)
         pool_list.set_model(poolListModel)
 
-        poolCol = Gtk.TreeViewColumn("Storage Pools")
+        poolCol = Gtk.TreeViewColumn(_("Storage Pools"))
         pool_txt = Gtk.CellRendererText()
         pool_per = Gtk.CellRendererText()
         poolCol.pack_start(pool_per, False)
diff --git a/virtinst/cloner.py b/virtinst/cloner.py
index 764388a..5255acf 100644
--- a/virtinst/cloner.py
+++ b/virtinst/cloner.py
@@ -544,7 +544,7 @@ class Cloner(object):
                 newd.target = disk.target
                 if validate:
                     if newd.wants_storage_creation():
-                        raise ValueError("Disk path '%s' does not exist." %
+                        raise ValueError(_("Disk path '%s' does not exist.") %
                                          newd.path)
             except Exception, e:
                 logging.debug("Exception creating clone disk objects",
@@ -560,7 +560,7 @@ class Cloner(object):
     # Cloning policy based on 'clone_policy', 'force_target' and 'skip_target'
     def _do_we_clone_device(self, disk):
         if not disk.target:
-            raise ValueError("XML has no 'dev' attribute in disk target")
+            raise ValueError(_("XML has no 'dev' attribute in disk target"))
 
         if disk.target in self.skip_target:
             return False
diff --git a/virtinst/devicedisk.py b/virtinst/devicedisk.py
index 591c93b..c7cd04d 100644
--- a/virtinst/devicedisk.py
+++ b/virtinst/devicedisk.py
@@ -489,8 +489,8 @@ class VirtualDisk(VirtualDevice):
     def _set_path(self, newpath):
         if (self._storage_backend and
             self._storage_backend.will_create_storage()):
-            raise ValueError("Can't change disk path if storage creation info "
-                             "has been set.")
+            raise ValueError(_("Can't change disk path if storage creation info "
+                               "has been set."))
 
         # User explicitly changed 'path', so try to lookup its storage
         # object since we may need it
diff --git a/virtinst/devicehostdev.py b/virtinst/devicehostdev.py
index 8a4c881..34c00b0 100644
--- a/virtinst/devicehostdev.py
+++ b/virtinst/devicehostdev.py
@@ -79,7 +79,7 @@ class VirtualHostDevice(VirtualDevice):
             self.managed = False
 
         else:
-            raise ValueError("Unknown node device type %s" % nodedev)
+            raise ValueError(_("Unknown node device type %s") % nodedev)
 
     def pretty_name(self):
         def dehex(val):
diff --git a/virtinst/devicerng.py b/virtinst/devicerng.py
index 7ed66b7..974735f 100644
--- a/virtinst/devicerng.py
+++ b/virtinst/devicerng.py
@@ -52,8 +52,8 @@ class VirtualRNGDevice(VirtualDevice):
 
     @staticmethod
     def get_pretty_mode(mode):
-        return {"bind" : "Bind",
-                "connect": "Connect"}.get(mode) or mode
+        return {"bind" : _("Bind"),
+                "connect": _("Connect")}.get(mode) or mode
 
     def supports_property(self, propname):
         """
diff --git a/virtinst/network.py b/virtinst/network.py
index a008f94..80c03d4 100644
--- a/virtinst/network.py
+++ b/virtinst/network.py
@@ -160,9 +160,10 @@ class Network(XMLBuilder):
                     desc = _("Routed network")
             else:
                 if dev:
-                    desc = "%s to %s" % (mode, dev)
+                    desc = (_("%(mode)s to %(device)s") %
+                            {"mode" : mode, "device" : dev})
                 else:
-                    desc = "%s network" % mode.capitalize()
+                    desc = _("%s network") % mode.capitalize()
         else:
             desc = _("Isolated network, internal and host routing only")
 
diff --git a/virtinst/seclabel.py b/virtinst/seclabel.py
index 99a22d6..10bf4e8 100644
--- a/virtinst/seclabel.py
+++ b/virtinst/seclabel.py
@@ -62,7 +62,7 @@ class Seclabel(XMLBuilder):
         if imagelabel:
             imglab_len = min(3, len(imagelabel.split(':')))
         if lab_len and imglab_len and lab_len != imglab_len:
-            raise ValueError("Label and Imagelabel are incompatible")
+            raise ValueError(_("Label and Imagelabel are incompatible"))
 
         lab_len = lab_len or imglab_len
         if lab_len == 3:
@@ -70,7 +70,7 @@ class Seclabel(XMLBuilder):
         elif lab_len == 2:
             return self.MODEL_DAC
         else:
-            raise ValueError("Unknown model type for label '%s'" % self.label)
+            raise ValueError(_("Unknown model type for label '%s'") % self.label)
     def _get_default_model(self):
         if self.type is None or self.type == self.TYPE_DEFAULT:
             return None
-- 
2.7.0




More information about the virt-tools-list mailing list