[virt-manager PATCH 12/21] i18n: avoid string puzzle in display autoport string

Pino Toscano ptoscano at redhat.com
Mon Jul 13 08:25:50 UTC 2020


When updating the checkbox aobut the automatic port, set a full string
(without or with the port) instead of "cutting" an existing label.
Not only it avoids to manipulate a UI string, it also allows translators
to properly translate the whole string that includes a port.

Signed-off-by: Pino Toscano <ptoscano at redhat.com>
---
 virtManager/device/gfxdetails.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virtManager/device/gfxdetails.py b/virtManager/device/gfxdetails.py
index 23b8c994..5475de26 100644
--- a/virtManager/device/gfxdetails.py
+++ b/virtManager/device/gfxdetails.py
@@ -160,12 +160,12 @@ class vmmGraphicsDetails(vmmGObjectUI):
             auto = self.widget(basename + "-auto")
             widget = self.widget(basename)
             auto.set_inconsistent(False)
-            label = auto.get_label().split(" (")[0]
+            label = _("A_uto")
 
             if val == -1 or gfx.autoport:
                 auto.set_active(True)
                 if val and val != -1:
-                    label += " (%s %s)" % (_("Port"), val)
+                    label = _("A_uto (Port %(port)d)") % {"port": val}
             elif val is None:
                 auto.set_inconsistent(True)
             else:
-- 
2.26.2




More information about the virt-tools-list mailing list