Skip to content

Commit

Permalink
Use ngettext in probably alive function
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Hall committed Jan 30, 2025
1 parent 4d484a2 commit 12baa7d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions gramps/gen/utils/alive.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
LOG = logging.getLogger(".gen.utils.alive")

_ = glocale.translation.sgettext
ngettext = glocale.translation.ngettext

DEBUGLEVEL = 4 # 4 = everything; 3 much detail; 2= minor detail; 1 = summary
# -------------------------------------------------------------------------
Expand Down Expand Up @@ -727,7 +728,11 @@ def estimate_bd_range_from_descendants(person):
date1.set_yr_mon_day(birth_year, 1, 1)
date1.set_modifier(Date.MOD_ABOUT)
date2 = date1.copy_offset_ymd(self.MAX_AGE_PROB_ALIVE)
explain = _("descendant birth: {} generations ".format(ngens))
explain = ngettext(
"descendant birth: {number_of} generation ",
"descendant birth: {number_of} generations ",
ngens,
).format(number_of=ngens)
elif dmin is not None:
# no births, just death dates ... unreliable estimates only
# An upper limit would be based on min_generation_gap below the first death.
Expand All @@ -746,7 +751,11 @@ def estimate_bd_range_from_descendants(person):
date1.set_modifier(Date.MOD_RANGE)
date1.set2_yr_mon_day(upper_birth_year, 1, 1)
date2 = date1.copy_offset_ymd(self.MAX_AGE_PROB_ALIVE)
explain = _("descendant death: {} generations ".format(ngens))
explain = ngettext(
"descendant death: {number_of} generation ",
"descendant death: {number_of} generations ",
ngens,
).format(number_of=ngens)
if date1 and date2:
return (date1, date2, explain, other)
return (None, None, "", None)
Expand Down

0 comments on commit 12baa7d

Please sign in to comment.