Another difference between Flask-BabelEx - jinja initialization
jwag956 opened this issue · 1 comments
Specifics:
As part of init_app():
Flask-BabelEx:
app.jinja_env.install_gettext_callables(
lambda x: get_domain().get_translations().ugettext(x),
lambda s, p, n: get_domain().get_translations().ungettext(s, p, n),
newstyle=True
)
And Flask-Babel:
app.jinja_env.install_gettext_callables(
lambda x: get_translations().ugettext(x),
lambda s, p, n: get_translations().ungettext(s, p, n),
newstyle=True
)
So Flask-Babel doesn't take into account the 'default domain' as specified in the init function.
Dialogue:
This was never clear to me and and seems like a missing link with Flask* an Babel - how applications could have translations and messages and domains but still utilize 3rd party library translations and messages - seems like Domains wasn't really thought through (or I don't understand it!).
For Flask-Security - I have already introduced a library specific jinja function (_fsdomain) that me tag my templates to be translated not with the default domain but with a specific domain.
Anyway - this change will break many things - so at a minimum I would suggest a release note/documentation...
Our (flask-babel) call to get_translations()
is just a shortcut for get_domain().get_translations()
, see
flask-babel/flask_babel/__init__.py
Line 207 in 2a99489