#18261 closed Cleanup/optimization (fixed)
Clarify the term "project root directory"
Reported by: | schnippi | Owned by: | Susan Tan |
---|---|---|---|
Component: | Documentation | Version: | 1.4 |
Severity: | Normal | Keywords: | project root, root directory, translation, makemessages, compilemessages |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The documentation at
https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files
states that
django-admin.py makemessages
should be run from "the root directory of your Django project" or "the root directory of your Django app".
As the Django 1.4 directory structure creates mysite/ and mysite/mysite/, it is unclear, what the project's root directory is. Running django-admin makemessages/compilemessages within mysite/ makes the the Django translation system ignore my translation file. Running the commands in mysite/mysite/ instead does work as expected.
It should be explicitly stated in the tutorial, that mysite/mysite/ is the project's root directory.
Attachments (2)
Change History (13)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 13 years ago
comment:3 by , 12 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:4 by , 11 years ago
Has patch: | set |
---|
comment:5 by , 11 years ago
FWIW the new default settings.py
refers to that directory as BASE_DIR
.
I wasn't a big fan of the BASE_DIR
wording (I prefer PROJECT_ROOT
) but now that it's there maybe we should refer to that directory as the "base directory".
by , 11 years ago
Attachment: | 18261.2.patch added |
---|
comment:6 by , 11 years ago
Could someone familiar with makemessages
confirm where it should be run from? I'd expect "project root" means the directory with manage.py
but based on what the reporters says, it seems like that directory didn't work for him. I've edited Susan's patch slightly, but it'll need further edits if the existing "project root" reference in translation.txt actually means "project module".
comment:7 by , 11 years ago
AFAIK makemessages
must be run from a directory that contains a locale/
subdirectory where the translations will be collected. locale/
can be anywhere as long as it's in LOCALE_PATHS
.
Django does *not* have a concept of a "project root", no matter how you frame it.
comment:8 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:9 by , 11 years ago
See PR: https://github.com/django/django/pull/1340/ Feel free to code review there.
comment:10 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I'm not familiar enough with the i18n toolchain to be sure where compilemessages/makemessages should be run, or why it would work in one place but not another, but we should _not_ document that
mysite/mysite
is the "project root directory". The latter is a confusing term that we should maybe just avoid using; if it should have any meaning, it should mean "the directory withmanage.py
", which would be justmysite/
. The inner directory is the "project module", the outer directory could be called the "workspace" or "container" or "project root".In general, we want people running most command-line stuff in the workspace directory (the one with manage.py), because that will set up sys.path correctly for all their imports to work. This may not apply to compilemessages/makemessages though.