djangotranslatehumanize

How translate humanize django


I need translate humanize to portuguese (pt-BR). How?

Import:

from django.contrib.humanize.templatetags.humanize import naturaltime

Using:

_question['pub_date'] = naturaltime(question.pub_date)

Settings:

LANGUAGE_CODE = 'pt-BR'

TIME_ZONE = 'America/Sao_Paulo'

USE_I18N = True

USE_L10N = True

USE_TZ = True

And in my template show this:

2 hours ago

Solution

  • I just need set humanize inside template and works.

    <span>{{question.pub_date|naturaltime}}</span>
    

    You need add in installed apps too

    'django.contrib.humanize',