Code

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#11284 closed (fixed)

Support i18n tags in templates with .js extension

Reported by: andrewbadr Owned by: ramiro
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 4 years ago.
SImple patch

Download all attachments as: .zip

Change History (10)

comment:1 Changed 5 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

comment:2 Changed 5 years ago by ramiro

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 5 years ago by mtredinnick

  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Triage Stage changed from Unreviewed to Accepted

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 5 years ago by garcia_marc

  • Owner changed from nobody to garcia_marc
  • Status changed from reopened to new

Changed 4 years ago by ramiro

SImple patch

comment:5 Changed 4 years ago by ramiro

  • Has patch set

comment:6 Changed 4 years ago by ramiro

  • milestone set to 1.2
  • Owner changed from garcia_marc to ramiro

comment:7 Changed 4 years ago by jezdez

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

(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 4 years ago by jezdez

(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 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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.