Search code examples
pythondjangotranslationdjango-rosetta

Django translation using rosetta not reflecting changes


I currently have a small problem using saleor:

First, I set the following configuration in saleor/settings.py:

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

Then I created the directory tree /locale/pt_BR/LC_MESSAGES 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 manage.py runserver)
  • manually running python manage.py 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:

http://pastebin.com/EwrMYYyA


Solution

  • 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 manage.py compilemessages) everything worked nicely.

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

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