lucaschain lucaschain - 1 year ago 59
Python Question

Django translation using rosetta not reflecting changes

I currently have a small problem using saleor:

First, I set the following configuration in saleor/

# other settings config
PROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
os.path.join(PROJECT_ROOT, "locale"),
USE_I18N = True
USE_L10N = True
USE_TZ = True

Then I created the directory tree
at the project's root.

After that, I opened up rosetta and started translating everything to my language code (pt_BR). Everything worked as expected, but I can't see the changes I made on the website.

I already tried:

  • restarting the server (
    python runserver

  • manually running
    python compilemessages
    with no errors on my edited .po file.

It generates the .po and .mo files inside the expected folder, but nothing seems to change (everything is still in english)

Additional info:
Django version 1.9.3
Python version 2.7

Does anybody have the same problem?
Thank you

----- Edit -----

This is my final (with the problem solved) .po file:

Answer Source

My problem was:

My django.po file was not filled with the correct language code:

"Language: \n"

so I changed to

"Language: pt_BR\n"

after re-compiling messages (python compilemessages) everything worked nicely.

Also, I found out the LOCALE_PATHS setting needed a slash after the path like this:

    os.path.join(PROJECT_ROOT, "locale/"),