#25162 closed Uncategorized (invalid)
Internationalization of static JS
Reported by: | Rignon Noël | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | 1.8 |
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
I want to translate a part of my JS in Django.
I've try the command
python manage.py makemessages -d djangojs
but it take only file in TEMPLATE_DIRS in the settings.py
I've try to set a JS in a template directory, and it work perfectly.
I've the djangojs.po and i can generate the .mo when i compile.
So it's a bug or how make message in static file ?
My architecture:
- myapp
- locale
- static
- myapp
- js
- try.js
- js
- myapp
- template
- myapp
- try.html
- myapp
- views.py
- urls.py
- [...]
Attachments (1)
Change History (7)
follow-up: 2 comment:1 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 by , 9 years ago
Replying to claudep:
The js files in your static directory should be extracted. Ensure that you didn't set STATIC_ROOT to
myapp/static
.
Please provide us with a sample project if you can reproduce this issue.
I've set this STATIC_ROOT = os.path.join(BASE_DIR, 'app/home/static')
But my JS is not extracted even if I put it in app/home/static
.
it's exctracted only in a template directory.
I'll create a simple project for you. I come back before next week.
comment:3 by , 9 years ago
You can try with this simple project :
python manage.py makemessages -d djangojs
turn if the JS file is in app/home/template/home
only
comment:4 by , 9 years ago
Resolution: | worksforme |
---|---|
Status: | closed → new |
comment:5 by , 9 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Thanks for the sample project. That's exactly what I tried to explain before. Setting STATIC_ROOT to an existing repository directory is a mistake. STATIC_ROOT is a directory where the collectstatic
management command is going to copy all static files from all apps, and it should NOT point to any of your app static directory.
makemessages
is purposefully excluding extraction from files inside STATIC_ROOT (as it's already extracting messages from the static files in their initial directory).
comment:6 by , 9 years ago
No, it is me who thank you. You do a very good work ;)
Sorry for the bad ticket, thanks again !
The js files in your static directory should be extracted. Ensure that you didn't set STATIC_ROOT to
myapp/static
.Please provide us with a sample project if you can reproduce this issue.