Customized translation of Humanize Django 2.2.x

Asked

Viewed 74 times

2

I realized that the version 2.2.7 from Django came up with the wrong humanize translation. I’m having a problem where my naturaltime is returning:

6mesesatrás and the stream would be 6 meses atrás.

Checking the translation of humanize, saw that the django.po is incorrect. I tried to follow the Steps to recreate the Django.po messages but am having difficulties.

1) I first created the folder locale_extra/pt_BR/LC_MESSAGES/ at the root of the project.

2) Within this directory I created the file: django.po

3) I added the Official Human Health Department but with the corrected translation.

4) I added the path to settings.py mentioning the locale standard and the locale_extra:

LOCALE_PATHS = (
    # default
    os.path.join(BASE_DIR, 'myproject', 'locale'),
    # custom
    os.path.join(BASE_DIR, 'myproject', 'locale_extra'),
)

5) I directed the command compilemessages and then makemessages.

Result: nothing happened. The error persists. I’m probably doing something wrong. Where I’m wrong and how could I correct the translation of humanize?

1 answer

1


I was running the command the wrong way and I realized that the folder locale_extra needed to be inside the myproject/project (where is the py Settings.).

The correct command is:

python manage.py makemessages -l pt_BR
python manage.py compilemessages -l pt_BR

Obs.: This way it will generate the django.mo and the translation will work correctly. I tried to pull request in the Django project but from what I understand the Transifex which makes the translation and makes 8 months that they do not correctly translate the humanize.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.