0

I'm using Flask Babel for web translation: When I write my config file like the following, it doesn't find any translations and the error is that jinja2.ext.autoescape and jinja2.ext.with_ are deprecated. babel.cfg

[python: **.py]
[jinja2: **/templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_

If I remove the extensions line, it doesn't read the tags with underscore _{{ "some text" }}, only the {{ get_text("some text")}}

[python: **.py]
[jinja2: **/templates/**.html]

How can I configure the underscore tag like _{{ "some text" }}?

1 Answers1

0

Even though the documentation was outdated on the Flask Babel side, it is clearly mentioned in Jinja documentation that you don't need those extensions anymore, here and here.

Also you are misusing the shortcut _ for gettext. Instead of _{{ "some text" }} you should be writing {{ _("some text") }}.

BcK
  • 2,548
  • 1
  • 13
  • 27