0

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

4

1 回答 1

1

我的问题是:

我的 django.po 文件没有填充正确的语言代码:

"Language: \n"

所以我改为

"Language: pt_BR\n"

重新编译消息(python manage.py compilemessages)后一切正常。

另外,我发现 LOCALE_PATHS 设置在路径后需要一个斜杠,如下所示:

LOCALE_PATHS = ( 
    os.path.join(PROJECT_ROOT, "locale/"),
)
于 2016-05-12T15:21:30.403 回答