In a Flask
application we recently upgraded Werkzeug
to 1.0.1 (so we could set the same site on cookies), which forced a few dependencies, among which Flask-BabelEx==0.9.4
.
After this upgrade, the handling of escaped % (percent signs) changed in a very troubling way. Where gettext('foo %%')
used to return *"foo %"*
, it now returns *"foo %%"*
, in other words, the escaping of % sign seems to not be handled. I thought, ok, a little upward incompatibility, we just have to replace all the %%
by %
in babel strings (in reference language as well as in all translations, so that's a big deal already).
But that's not the end of the story, because for all babel strings used within Jinja2 templates, such as {{ _("This is a percent sign: %") }}
, the escaping of %
signs is still handled, so this still needs to be {{ _("This is a percent sign: %%") }}
. So do we have to handle both %
-escaped and unescaped babel strings depending on where they are used? Is there a setting somewhere that would alleviate this escaping issue.