Skip to content

Commit

Permalink
BUG: Use %d for year translations convert to string for intcomma after
Browse files Browse the repository at this point in the history
This patch fixes a bug introduced in 3.14.0, where the format
string was changed from %d to %s to add separators to the year.
However, this needs to happen after translation because the
translator uses the format strings as part of the translation.

Closes python-humanize#21
  • Loading branch information
carterbox committed Jun 20, 2022
1 parent 29d37fb commit 6c1d0c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/humanize/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def naturaldelta(
else:
return _ngettext("1 year, %d day", "1 year, %d days", days) % days

return _ngettext("%s year", "%s years", years) % intcomma(years)
return _ngettext("%d year", "%d years", years).replace("%d", "%s") % intcomma(years)


def naturaltime(
Expand Down

0 comments on commit 6c1d0c7

Please sign in to comment.