Ticket #4137: django.util.timesince.i18n.patch.diff

File django.util.timesince.i18n.patch.diff, 919 bytes (added by Sung-Jin Hong <serialx.net@…>, 17 years ago)

django.util.timesince i18n patch

  • django/utils/timesince.py

     
    3737        if count != 0:
    3838            break
    3939    if count < 0:
    40         return '%d milliseconds' % math.floor((now - d).microseconds / 1000)
    41     s = '%d %s' % (count, name(count))
     40        return _('%d milliseconds') % math.floor((now - d).microseconds / 1000)
     41    s = _('%(number)d %(type)s') % {'number':count, 'type':name(count)}
    4242    if i + 1 < len(chunks):
    4343        # Now get the second item
    4444        seconds2, name2 = chunks[i + 1]
    4545        count2 = (since - (seconds * count)) / seconds2
    4646        if count2 != 0:
    47             s += ', %d %s' % (count2, name2(count2))
     47            s += _(', %(number)d %(type)s') % {'number':count2, 'type':name2(count2)}
    4848    return s
    4949
    5050def timeuntil(d, now=None):
Back to Top