[virt-manager PATCH 14/16] i18n: use plural forms where needed
Pino Toscano
ptoscano at redhat.com
Tue Jul 14 07:41:58 UTC 2020
Use plural forms for strings that depend on a runtime value, like a
count. This way they will get the proper string for the actual value.
Signed-off-by: Pino Toscano <ptoscano at redhat.com>
---
virtManager/createvm.py | 4 +++-
virtinst/devices/disk.py | 6 ++++--
virtinst/virtinstall.py | 5 +++--
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/virtManager/createvm.py b/virtManager/createvm.py
index 1120ea2a..d7322e82 100644
--- a/virtManager/createvm.py
+++ b/virtManager/createvm.py
@@ -660,7 +660,9 @@ class vmmCreateVM(vmmGObjectUI):
# CPU
phys_cpus = int(self.conn.host_active_processor_count())
- cpu_label = (_("Up to %(numcpus)d available") %
+ cpu_label = (ngettext("Up to %(numcpus)d available",
+ "Up to %(numcpus)d available",
+ phys_cpus) %
{'numcpus': int(phys_cpus)})
cpu_label = ("<span size='small'>%s</span>" % cpu_label)
self.widget("cpus").set_range(1, max(phys_cpus, 1))
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index 785b0607..849e9ec1 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -850,8 +850,10 @@ class DeviceDisk(Device):
return ret
raise ValueError(
- _("Only %(number)s disks for bus '%(bus)s' are supported") %
- {"number": maxnode, "bus": self.bus})
+ ngettext("Only %(number)s disk for bus '%(bus)s' are supported",
+ "Only %(number)s disks for bus '%(bus)s' are supported",
+ maxnode) %
+ {"number": maxnode, "bus": self.bus})
def change_bus(self, guest, newbus):
"""
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
index fe36a47f..b9e85f2b 100644
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -639,8 +639,9 @@ class WaitHandler:
def get_time_string(self):
if self._wait_forever:
return _("Waiting for the installation to complete.")
- return (_("Waiting %(minutes)d minutes for the installation to complete.") %
- {"minutes": self._wait_mins})
+ return ngettext("Waiting %(minutes)d minute for the installation to complete.",
+ "Waiting %(minutes)d minutes for the installation to complete.",
+ self._wait_mins) % {"minutes": self._wait_mins}
def wait(self):
"""
--
2.26.2
More information about the virt-tools-list
mailing list