[Django]-Pgettext in jinja2 django templates

3👍

I don’t believe that what you want exists in Jinja… (at least for now)

If you take a look at this issue the developer pretty much states that he won’t do it:

This would require patches as I’m not using pgettext myself.

Then he closed the issue.
This was created back in 2014 and something may have changed but I don’t think so (based on another issue).

By searching a bit around I found this project which may help: https://pypi.python.org/pypi/jinja2-django-tags/0.1. There I read:

You can also use _, gettext and pgettext directly:

Simple example: {{ _('Hello World') }}
More verbose: {{ gettext('Hello World') }}
With context: {{ pgettext('Hello World', 'another example') }}

Good luck 🙂

Leave a comment