Opened 13 years ago

Closed 13 years ago

Last modified 13 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: no

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 13 years ago.
ungettext_naturaltime - fix gettext in naturaltime template filter

Download all attachments as: .zip

Change History (5)

by Gasper Zejn, 13 years ago

Attachment: ungettext_naturaltime.py added

ungettext_naturaltime - fix gettext in naturaltime template filter

comment:1 by Gasper Zejn, 13 years ago

Ah, forgot to add.

Tests still pass, no new tests added.

comment:2 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: newclosed

In [16181]:

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

comment:3 by davidchambers, 13 years ago

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 by Jannis Leidel, 13 years ago

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

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