Code

Opened 6 years ago

Closed 6 years ago

#7180 closed (duplicate)

make-messages.py using I18N_TEMPLATES_EXTENSIONS from settings...

Reported by: anonymous Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords: make-messages.py i18n
Cc: patrick.lauber@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It would be nice if the make-messages.py script would use the I18N_TEMPLATES_EXTENSIONS from the settings file and not only parse .html files. In case one defines multiple templates extensions like:

I18N_TEMPLATES_EXTENSIONS = ('.html', '.tpl')

The make-messages.py will not consider the .tpl file. The annoying part is that even when the keys (msgid, msgstr) are manually added, every time the script runs, it comments out the not recognized or detected pairs.

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by tumma72@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Sorry i forgot to put the email...

an easy patch would be to read from settings.I18N_TEMPLATES_EXTENSIONS and at line 103:

     os.unlink(os.path.join(dirpath, thefile))
            elif domain == 'django' and (file.endswith('.py') or file.endswith('.html')):
                thefile = file
                if file.endswith('.html'):

and change it with:

            file_ext = file.split('.').pop()
            elif domain == 'django' and (file.endswith('.py') or file_ext in settings.I18N_TEMPLATES_EXTENSIONS):
                thefile = file
                if file_ext in settings.I18N_TEMPLATES_EXTENSIONS:

I didn't really try it out, is just a quick idea that cames out while writing... sorry, I think there are surely more elegant way to solve the problem :-)

Compliments for the Great Framework :-)

comment:2 Changed 6 years ago by Patrick Lauber <patrick.lauber@…>

  • Cc patrick.lauber@… added

It would be nice if it parses all files in the templates directory and you don't have to specify it.

comment:3 Changed 6 years ago by jacob

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

Duplicate of #5463 (which has a fix).

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.