Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#31914 closed Bug (invalid)

Django does not pick up .mo files when LOCALE_PATHS is unset

Reported by: Ondřej Kolín Owned by: nobody
Component: Internationalization Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ondřej Kolín)

Update: Kinda resolved, see my comment.

  1. Set LANGUAGE_CODE and LANGUAGES in settings.py
  2. You are able to makemessages and compilemessages
  3. Django is not picking up the translated messages
  4. Set the LOCALE_PATHS variable in the settings.py
  5. django now picks the messages

Fragment of settings.py

LANGUAGE_CODE = 'en'
LANGUAGES =[ ('en', _('English')), ('cs', _('Czech')) ]
LOCALE_PATHS = (
    os.path.join(BASE_DIR, 'locale'),
)

If this is intended, I think that makemessages/compile messages should fail as well. If not, the discovery should work as well.

Basic dir structure
.
├── db.sqlite3
├── locale
├── manage.py
├── safecloud
├── secshare
└── static

cat ./../venv/pyvenv.cfg
home = /usr/bin
include-system-site-packages = false
version = 3.8.3

Attachments (2)

without_locales_path_set.png (174.3 KB ) - added by Ondřej Kolín 4 years ago.
Without locales path set
with_locales_path_set.png (161.4 KB ) - added by Ondřej Kolín 4 years ago.

Download all attachments as: .zip

Change History (6)

by Ondřej Kolín, 4 years ago

Without locales path set

by Ondřej Kolín, 4 years ago

Attachment: with_locales_path_set.png added

comment:1 by Ondřej Kolín, 4 years ago

Description: modified (diff)

comment:2 by Ondřej Kolín, 4 years ago

Description: modified (diff)

comment:3 by Ondřej Kolín, 4 years ago

Description: modified (diff)
Resolution: fixed
Status: newclosed

As @felix pointed on irc.freenode.org #django-dev, the behaviour is documented.

But I still think this is kinda bug, or at least inconsistent, because, where is the point to be able to gather messages/compile them, but they stay unusable in the system, because the var is not set.

I think, that ./managepy compilemessages should throw a warning at least.

comment:4 by Mariusz Felisiak, 4 years ago

Resolution: fixedinvalid
Note: See TracTickets for help on using tickets.
Back to Top