[Fixed]-Django Internationalization (I18N) not changing text

1πŸ‘

βœ…

I think my path was not correct. I believe the extra slash was wrong… I deleted /translations/ from the LOCALE_PATH and it is working now.

LOCALE_PATHS = [
    os.path.join(BASE_DIR, 'locale'),
]

Then I run

django-admin compilemessages -l pt_BR

Modify the *.po generated and run

django-admin compilemessages -l pt_BR

I also renamed en-us to en in LANGUAGE_CODE = 'en-us'

0πŸ‘

Please follow this steps.

1) Create folder 'locale' in root.

2) Add middeleware

.....
'django.middleware.common.CommonMiddleware',
'django.middleware.locale.LocaleMiddleware',
....

3) In settings.py Set

USE_L10N = True

LANGUAGE_CODE = 'pt-BR'

LOCALE_PATHS = (
    os.path.join(BASE_DIR, 'locale'),
)

LANGUAGES = (
    ('pt_BR', 'Portuguese'),
)

4) Run following commands

$ django-admin makemessages -l pt_BR -i env
$ django-admin compilemessages -l pt_BR

5) Then update required translated text in locale > pt_BR > LC_MESSAGES > django.po then again run

$ django-admin compilemessages -l pt_BR

Leave a comment