Opened 16 years ago
Closed 14 years ago
#10765 closed (fixed)
Problem with translations when the settings module is a folder
Reported by: | vbmendes | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | 1.0 |
Severity: | Keywords: | translation settings project path | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
My settings module is a folder with some kind of organization, to make things more clean and mantainable. The fact is that django allways gets the project path by the settings module path, so my project path is always wrong: real_project_path/settings.
When I try to create my own translations in my project, django don't recognize it, becouse it looks in real_project_path/settings/locale instead of real_project_path/locale.
I make a very simple patch that fixes this problem, but the better way is to create a simple constant to store the project path. Maybe settings.PROJECT_ROOT_PATH, or something like this. I already have this constant in all my projects, and know of many people with this same practice.
Attachments (1)
Change History (5)
by , 16 years ago
Attachment: | settings_folder_problem.diff added |
---|
comment:1 by , 16 years ago
Component: | Uncategorized → Internationalization |
---|
comment:2 by , 16 years ago
Has patch: | set |
---|
comment:3 by , 16 years ago
Has patch: | unset |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
This patch isn't a very nice way to go about this. Hardcoding things like the string __init__.py
looks ugly and a bit fragile. The comments are also a bit uncertain (and we shouldn't be using words like "folder" in comments when there are more accurate Python terms). "Project level" stuff is always a bit tricky in Django, so maybe it's something that simply doesn't work if you aren't using a simple module for settings.
There should be a better solution here with respect to specifying a non-app translation directory. This patch isn't it, but the problem is possibly valid.
Patch to fix the problem