i18n: use plural forms where needed

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.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
Pino Toscano 2020-07-14 09:41:58 +02:00 committed by Cole Robinson
parent cd15c72dfb
commit 6f30ab2437
3 changed files with 10 additions and 5 deletions

View File

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

View File

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

View File

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