From c9d095ab3ee46ffdd3cbe6da8b5b8500a9a28e6f Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Tue, 28 Jan 2025 21:17:38 +0000 Subject: [PATCH] Use ngettext when displaying the max probably alive age in years This is needed when translating some languages. --- gramps/gen/lib/date.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gramps/gen/lib/date.py b/gramps/gen/lib/date.py index e9f5fb4a32b..bb0f8bc0d74 100644 --- a/gramps/gen/lib/date.py +++ b/gramps/gen/lib/date.py @@ -292,6 +292,7 @@ def get_repr(self, as_age=False, dlocale=glocale): """ # trans_text is a defined keyword (see po/update_po.py, po/genpot.sh) trans_text = dlocale.translation.sgettext + ngettext = dlocale.translation.ngettext _repr = trans_text("unknown") # FIXME all this concatenation will fail for RTL languages -- really?? if self.valid: @@ -300,7 +301,11 @@ def get_repr(self, as_age=False, dlocale=glocale): self._diff(self.date1, self.date2), dlocale ).format(precision=1) if as_age and self._diff(self.date1, self.date2)[0] > Span.ALIVE: - _repr = trans_text("greater than %s years") % Span.ALIVE + _repr = ngettext( + "greater than {number_of} year", + "greater than {number_of} years", + Span.ALIVE, + ).format(number_of=Span.ALIVE) elif self.date1.get_modifier() == Date.MOD_NONE: if self.date2.get_modifier() == Date.MOD_NONE: _repr = fdate12