Skip to content

Commit

Permalink
Use ngettext when displaying the max probably alive age in years
Browse files Browse the repository at this point in the history
This is needed when translating some languages.
  • Loading branch information
Nick-Hall committed Jan 28, 2025
1 parent c1169b5 commit 6f839ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gramps/gen/lib/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 6f839ac

Please sign in to comment.