Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#15981 closed Cleanup/optimization (fixed)

Use ungettext instead of _ for naturaltime

Reported by: gasperzejn 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 gasperzejn 4 years ago.
ungettext_naturaltime - fix gettext in naturaltime template filter

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by gasperzejn

ungettext_naturaltime - fix gettext in naturaltime template filter

comment:1 Changed 4 years ago by gasperzejn

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Ah, forgot to add.

Tests still pass, no new tests added.

comment:2 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

In [16181]:

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

comment:3 Changed 4 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 4 years ago by jezdez

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

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