mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 09:22: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,7 +213,12 @@ def create_app(
|
|||
setattr(g, "lang", lang)
|
||||
return lang
|
||||
|
||||
Babel(app, default_timezone=default_timezone, locale_selector=get_locale)
|
||||
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)
|
||||
|
||||
# Undocumented currencyformat filter from flask_babel is forwarding to Babel format_currency
|
||||
# We overwrite it to remove the currency sign ¤ when there is no currency
|
||||
|
|
Loading…
Reference in a new issue