[virt-manager PATCH 06/21] i18n: improve labels for serial/parallel/console

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Split the handling of serial, parallel, and console in their own cases,
as the common code is less than the non-common one.

Use separate strings in case the port number is available to avoid
string puzzles.

Signed-off-by: Pino Toscano <ptoscano@xxxxxxxxxx>
---
 virtManager/details/details.py | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/virtManager/details/details.py b/virtManager/details/details.py
index 791a5ae1..6911a0bd 100644
--- a/virtManager/details/details.py
+++ b/virtManager/details/details.py
@@ -201,16 +201,20 @@ def _label_for_device(dev):
             return _("Keyboard")
         return _("Input")
 
-    if devtype in ["serial", "parallel", "console"]:
-        if devtype == "serial":
-            label = _("Serial")
-        elif devtype == "parallel":
-            label = _("Parallel")
-        elif devtype == "console":
-            label = _("Console")
+    if devtype == "serial":
         if dev.target_port is not None:
-            label += " %s" % (int(dev.target_port) + 1)
-        return label
+            return _("Serial %(num)d") % {"num": int(dev.target_port) + 1}
+        return _("Serial")
+
+    if devtype == "parallel":
+        if dev.target_port is not None:
+            return _("Parallel %(num)d") % {"num": int(dev.target_port) + 1}
+        return _("Parallel")
+
+    if devtype == "console":
+        if dev.target_port is not None:
+            return _("Console %(num)d") % {"num": int(dev.target_port) + 1}
+        return _("Console")
 
     if devtype == "channel":
         name = vmmAddHardware.char_pretty_channel_name(dev.target_name)
-- 
2.26.2




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux