Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#11284 closed (fixed)

Support i18n tags in templates with .js extension

Reported by: Andrew Badr Owned by: Ramiro Morales
Component: Internationalization Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

We are using dynamically generated javascript that includes strings for translation. These are marked with the trans template tag. There is no way to get these strings added to a pofile, since makemessages forcefully rejects the 'js' extension.

Attachments (1)

11284.diff (538 bytes) - added by Ramiro Morales 7 years ago.
SImple patch

Download all attachments as: .zip

Change History (10)

comment:1 Changed 7 years ago by Malcolm Tredinnick

Resolution: invalid
Status: newclosed

Have a look at the "-e" option to django-admin.py makemessages (django-admin.py help makemessages).

comment:2 Changed 7 years ago by Ramiro Morales

Malcolm, actually I think we are eplicitly rejecting the .js extension when the user specifies it with the -e/--extension command line option: http://code.djangoproject.com/browser/django/trunk/django/core/management/commands/makemessages.py?rev=10833#L226

comment:3 Changed 7 years ago by Malcolm Tredinnick

Resolution: invalid
Status: closedreopened
Triage Stage: UnreviewedAccepted

Ah, I understand what you (both) are saying now. My mistake. Okay, we need to let people shoot themselves in the foot so that people doing the right thing can get their work done. This is definitely worth changing, because Django's current approach to i18n in Javascript is pretty cache unfriendly, so allowing workarounds for when it's appropriate is a Good Thing.

comment:4 Changed 7 years ago by Marc Garcia

Owner: changed from nobody to Marc Garcia
Status: reopenednew

Changed 7 years ago by Ramiro Morales

Attachment: 11284.diff added

SImple patch

comment:5 Changed 7 years ago by Ramiro Morales

Has patch: set

comment:6 Changed 7 years ago by Ramiro Morales

milestone: 1.2
Owner: changed from Marc Garcia to Ramiro Morales

comment:7 Changed 7 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

(In [12439]) Fixed #11284 - Stop forcing the use of the djangojs domain when the ".js" file extension is passed to makemessages management command. Thanks, Ramiro Morales.

comment:8 Changed 7 years ago by Jannis Leidel

(In [12450]) [1.1.X] Fixed #11284 - Stop forcing the use of the djangojs domain when the ".js" file extension is passed to makemessages management command. Thanks, Ramiro Morales.

Backport of r12439.

comment:9 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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