Skip to content

Commit

Permalink
Add .format() fixes needed for pybabel.
Browse files Browse the repository at this point in the history
  • Loading branch information
almet committed Dec 10, 2022
1 parent c3e1b1b commit f3ddc73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ihatemoney/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ def flash_email_error(error_message, category="danger"):
error_extension = f" or contact the administrator at {admin_email}."

flash(
# .format needed for pybabel https://github.com/python-babel/babel/issues/715
_(
f"{error_message} Please check the email configuration of the server{error_extension}"
),
"{error_message} Please check the email configuration of the server{error_extension}"
).format(error_message=error_message, error_extension=error_extension),
category=category,
)

Expand Down
6 changes: 5 additions & 1 deletion ihatemoney/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,11 @@ def change_lang(lang):
session["lang"] = lang
session.update()
else:
flash(_(f"{lang} is not a supported language"), category="warning")
flash(
# .format needed for pybabel https://github.com/python-babel/babel/issues/715
_("{lang} is not a supported language").format(lang=lang),
category="warning",
)

return redirect(request.headers.get("Referer") or url_for(".home"))

Expand Down

0 comments on commit f3ddc73

Please sign in to comment.