Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#15981 closed Cleanup/optimization (fixed)

Use ungettext instead of _ for naturaltime

Reported by: Gasper Zejn Owned by: nobody
Component: contrib.humanize Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX:

Description

I went updating translation today and I see that naturaltime template filter uses gettext improperly which as a consequence makes it hard to translate.

Attached patch fixes this and also removes redundant if clauses.

Attachments (1)

ungettext_naturaltime.py (1.0 KB) - added by Gasper Zejn 5 years ago.
ungettext_naturaltime - fix gettext in naturaltime template filter

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by Gasper Zejn

Attachment: ungettext_naturaltime.py added

ungettext_naturaltime - fix gettext in naturaltime template filter

comment:1 Changed 5 years ago by Gasper Zejn

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Ah, forgot to add.

Tests still pass, no new tests added.

comment:2 Changed 5 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

In [16181]:

Fixed #15981 -- Use ungettext instead of manually checking for plurals. Thanks, gasperzejn.

comment:3 Changed 5 years ago by davidchambers

Shouldn't the first argument in return ungettext(u'%s seconds ago', u'%s seconds ago', delta.seconds) be u'a second ago'?

comment:4 Changed 5 years ago by Jannis Leidel

Yeah, there are other bugs in here, too. About to fix those.

Note: See TracTickets for help on using tickets.
Back to Top