﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20811	Makemessages currently does not support alternative template languages	cordery@…	nobody	"Makemessages currently does not support alternative template languages, as it uses open() directly and therefore does not give alternative template languages the chance to preprocess templates.  This seems an oversight as alternative template languages seems to be intended to be supported by Django, as discussed here https://docs.djangoproject.com/en/dev/ref/templates/api/#using-an-alternative-template-language

When using alternative template languages like hamlpy (https://github.com/jessemiller/HamlPy), this prevents the templates from being parsed for trans and blocktrans tags.  

In hamlpy they tried to solve it by monkeypatching django.utils.translation.trans_real.templatize but I think a better solution would be add a function to the loader module, get_template_source(), which operates using the same machinery as get_template but returns source rather than the compiled template.  Makemessages could then use this new function to try to read each discovered file using the template loaders, before resorting to open().

This would enable makemessages to properly find trans and blocktrans tags in template files from other templating systems.  For example in hamlpy these tags might appear like this:


{{{
- trans ""hello""
- blocktrans
  This is a block trans'd string.
}}}

Which could not be read by makemessages.  get_template_source would use the hamlpy loader to load the template.haml file, and compile it to:

{{{
{% trans ""hello""
{% blocktrans %}
This is a block trans'd string
{% endblocktrans %}
}}}

Which can be read by makemessages.

I will momentarily submit a pull request regarding this ticket."	New feature	closed	Internationalization	dev	Normal	wontfix	makemessages i18n		Accepted	1	0	0	1	0	0
