Coder Social home page Coder Social logo

Comments (4)

graingert avatar graingert commented on June 19, 2024

It looks like {% call %} is a custom template tag

from django-babel.

joeribekker avatar joeribekker commented on June 19, 2024

It's part of Jinja, yes. I don't think it has to do with that, but rather that it does work within block tags, but not within variable tags that has additional stuff (like a macro call).

Just after posting the issue here, we got it to work by reverting to our previous mapping file used by pybabel*:

-[django: templates/**.tmpl]
+[jinja2: templates/**.tmpl]
+extensions= jinja2.ext.i18n, jinja2.ext.with_

*To make that work we also added from django.conf import settings; settings.configure() to the pybabel script or it would complain.

When upgrading, we thought these extension would be picked up from the Django 1.8 template settings, where these extension are also defined:

TEMPLATES = [
    {
        'BACKEND': 'django_jinja.backend.Jinja2',
        'OPTIONS': {
            'debug': DEBUG,
            'match_extension': '.tmpl',
            'extensions': [
                'jinja2.ext.with_',
                'jinja2.ext.i18n',
                'django_jinja.builtins.extensions.UrlsExtension',
                'django_jinja.builtins.extensions.CsrfExtension',
            ],
            ...
        }
    }
]

from django-babel.

graingert avatar graingert commented on June 19, 2024

@joeribekker can you create a PR with some tests that use Jinja2 in your usecase?

from django-babel.

akx avatar akx commented on June 19, 2024

You should use Jinja's Babel extractor with Jinja-based templates, not the Django one.

from django-babel.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.