syrusakbary / pyjade

Jade template system for Django, Jinja2 and Mako
MIT License
699 stars 122 forks source link

trans and blocktrans not processed by makemessages in django #37

Closed iceripple closed 11 years ago

iceripple commented 12 years ago

Django's makemessages management command does not collect strings for translation under -trans or -blocktrans

No idea if that is even possible.

workaround is to use original django style tags {% trans %} and {%blocktrans%}

syrusakbary commented 12 years ago

Hi, try to write

import pyjade.ext.django

On the __init__.py file of your project ;)

syrusakbary commented 12 years ago

Or maybe just adding 'pyjade.ext.django' into INSTALLED_APSS

cauethenorio commented 11 years ago

Curiously, in Django 1.5, adding 'pyjade.ext.django' in INSTALLED_APPS only will work if you use the command makemessages with the --verbosity parameter greather than one (-v 2 or -v 3).

It happens because when is used --verbosity greather than one, is displayed the message examining files with the extensions: ext1, ext2 and ext3. This message uses the django.utils.translation import trans_real.ugettext to translate the comma (', 'part) and so initialize the translation framework, including the load of the INSTALLED_APPS, to load the locale directory of them, and so, the templatize pyjade decorator is installed.

It not happens when the parameter --verbosity is not used or is used as one, because that way no message is displayed, and so the translations framework is not loaded and no installed app is loaded either.

I suggest add import pyjade.ext.django at the top of the settings file, there it always will be read when the command is run.

fellu commented 11 years ago

Hi, any suggestions how we can use django templates and jade templates? If running makemessages with pyjade.ext.django, django templates prints following error: Exception: unexpected token "indent" in file None on line 10 , file is .html file and line 10 is just empty line.

syrusakbary commented 11 years ago

I will check it later. Seems that pyjade is processing not only .jade files, but also .html ones.

carlware commented 9 years ago

I have the same issue but using django 1.7.4 I tried adding import pyjade.ext.django to __init__.py and adding 'pyjade.ext.django' to INSTALLED_APPS. Any idea ?

jmp0xf commented 9 years ago

I met the same problem. Deeply custom tags are huge hazards in a black box working with various Django backend. A less intrusive method is more appealing, say pre-processing the custom tags.