Opened 8 years ago

Closed 8 years ago

#7180 closed (duplicate) using I18N_TEMPLATES_EXTENSIONS from settings...

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


It would be nice if the 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 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.

Change History (3)

comment:1 Changed 8 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 8 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 8 years ago by Jacob

Resolution: duplicate
Status: newclosed

Duplicate of #5463 (which has a fix).

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