mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
add compatibility for flask-babel 2 and 3
This commit is contained in:
parent
113e010dc5
commit
0039fdaf77
1 changed files with 6 additions and 1 deletions
|
@ -213,6 +213,11 @@ def create_app(
|
||||||
setattr(g, "lang", lang)
|
setattr(g, "lang", lang)
|
||||||
return lang
|
return lang
|
||||||
|
|
||||||
|
if hasattr(Babel, 'localeselector'):
|
||||||
|
# Compatibility for flask-babel <= 2
|
||||||
|
babel = Babel(app, default_timezone=default_timezone)
|
||||||
|
babel.localeselector(get_locale)
|
||||||
|
else:
|
||||||
Babel(app, default_timezone=default_timezone, locale_selector=get_locale)
|
Babel(app, default_timezone=default_timezone, locale_selector=get_locale)
|
||||||
|
|
||||||
# Undocumented currencyformat filter from flask_babel is forwarding to Babel format_currency
|
# Undocumented currencyformat filter from flask_babel is forwarding to Babel format_currency
|
||||||
|
|
Loading…
Reference in a new issue