[virt-manager PATCH 14/21] i18n: improve items in destination combo

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


Translate as a whole the UI description of a URI along with the detail
for it, if available. This way there is no string puzzle, and it is
possible to tune the detail string according to the language.

Signed-off-by: Pino Toscano <ptoscano at redhat.com>
---
 virtManager/migrate.py | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/virtManager/migrate.py b/virtManager/migrate.py
index 19067dd0..e6b12892 100644
--- a/virtManager/migrate.py
+++ b/virtManager/migrate.py
@@ -290,21 +290,19 @@ class vmmMigrateDialog(vmmGObjectUI):
         origuri = self.conn.get_uri()
 
         can_migrate = False
-        desc = destconn.get_pretty_desc()
-        reason = ""
+        pretty_uri = destconn.get_pretty_desc()
+        desc = pretty_uri
         desturi = destconn.get_uri()
 
         if destconn.get_driver() != driver:
-            reason = _("Hypervisors do not match")
+            desc = _("%(uri)s (Hypervisors do not match)") % {"uri": pretty_uri}
         elif destconn.is_disconnected():
-            reason = _("Disconnected")
+            desc = _("%(uri)s (Disconnected)") % {"uri": pretty_uri}
         elif destconn.get_uri() == origuri:
-            reason = _("Same connection")
+            desc = _("%(uri)s (Same connection)") % {"uri": pretty_uri}
         elif destconn.is_active():
             can_migrate = True
 
-        if reason:
-            desc = "%s (%s)" % (desc, reason)
         return [desc, desturi, can_migrate]
 
     def _populate_destconn(self):
-- 
2.26.2




More information about the virt-tools-list mailing list