Code

Opened 2 years ago

Closed 10 months ago

Last modified 10 months ago

#18261 closed Cleanup/optimization (fixed)

Clarify the term "project root directory"

Reported by: schnippi Owned by: susan
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)

18261.patch (1.7 KB) - added by susan 10 months ago.
A small doc patch for tutorial01.txt.
18261.2.patch (1.8 KB) - added by timo 10 months ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 2 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 2 years ago by carljm

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 with manage.py", which would be just mysite/. 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.

comment:3 Changed 14 months ago by aaugustin

  • Type changed from Uncategorized to Cleanup/optimization

Changed 10 months ago by susan

A small doc patch for tutorial01.txt.

comment:4 Changed 10 months ago by susan

  • Has patch set

comment:5 Changed 10 months ago by loic84

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".

Changed 10 months ago by timo

comment:6 Changed 10 months ago by timo

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 Changed 10 months ago by aaugustin

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 Changed 10 months ago by susan

  • Owner changed from nobody to susan
  • Status changed from new to assigned

comment:9 Changed 10 months ago by susan

See PR: https://github.com/django/django/pull/1340/ Feel free to code review there.

comment:10 Changed 10 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In ef3fddf26e8bfe956a52c2aa678db6637caf7adf:

Fixed #18261 -- Clarified 'project root directory'

comment:11 Changed 10 months ago by Tim Graham <timograham@…>

In 5192dbbf5546eb62e1c24d36d91f270b1a2b5eaf:

[1.5.x] Fixed #18261 -- Clarified 'project root directory'

Backport of ef3fddf26e from master

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.