Opened 15 years ago

Closed 15 years ago

Last modified 12 years ago

#12377 closed (wontfix)

Make the makemessages command more open

Reported by: Kevin Renskers Owned by: nobody
Component: Internationalization Version:
Severity: Keywords: makemessages i18n
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am using Jinja2 instead of the Django template system in a test project. Everything is working fine, but I am running into a small problem regarding i18n:

The command "django-admin makemessages" doesn't find the translation strings, because the Jinja2 format differs from the Django format.

Django syntax:

{% trans "Hello" %}
{% blocktrans %}Hello{% endblocktrans %}

Jinj2 syntax:

{{ _('Hello') }}
{% trans %}Hello{% endtrans %}

The underscore syntax work fine, but the trans/endtrans doesn't: the regular expressions used by makemessages don't account for different template tags. As far as I can see there is no possible way to configure the system so it can work with different tags. It seems like a good idea to open this up, so different template systems can be used more easily.

Change History (3)

comment:1 by Jannis Leidel, 15 years ago

Component: django-admin.pyInternationalization
Triage Stage: UnreviewedDesign decision needed
Version: 1.1

comment:2 by Ramiro Morales, 15 years ago

"Configuring the system so it can work with diferent tags" would mean that there needs to be support code in Django makemessages command that caters for compatibility with one third party templating system (and after the first, possibly there will be request for more). This means Django developers would need to maintain and test that code.

This would be better served by a custom template tag and/or management command users that need to use templating library X can write by themselves to cover their very specific needs. The most popular of these systems even have their own i18n system that can be used for this. In the case of Jinja2 it is Babel-based: http://jinja.pocoo.org/2/documentation/integration#babel-integration

I'd suggest to close this ticket.

Last edited 12 years ago by Ramiro Morales (previous) (diff)

comment:3 by Jannis Leidel, 15 years ago

Resolution: wontfix
Status: newclosed

Babel rocks with Jinja2.

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