Utilities#

quart_babel.get_babel(app: Quart | None = None) BabelConfiguration#

Returns the BabelConfiguration from the application.

quart_babel.refresh() None#

Refreshes the cached timezones and locale information. This can be used to switch a translation between a request and if you want the changes to take place immediately, not just with the next request:

user.timezone = request.form['timezone']
user.locale = request.form['locale']
refresh()
flash(gettext('Language was changed'))

Without that refresh, the flash() function would probably return English text and a now German page.