Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ngettext when displaying the max probably alive age in years #1890

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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