i18n: avoid string puzzle in display autoport string

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.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
Pino Toscano 2020-07-13 10:25:50 +02:00 committed by Cole Robinson
parent 6d970949f1
commit deb6462843
1 changed files with 2 additions and 2 deletions

View File

@ -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: