{% if prefs_filter is defined and prefs_filter|length %} {% with messages = get_flashed_messages(with_categories=True, category_filter=prefs_filter) %} {% for category, message in messages %} {# Get the end of the of the category message which contains the category status.(success/error/notification)#} {% set category_status = category.split('-')|last %}
{% if category_status == "success" %} {{ gettext('Success') }} {% elif category_status == "error" %} {{ gettext('Error') }} {% elif category_status == "notification" %} {{ gettext('Notification') }} {% endif %} {{ message }}
{% endfor %} {% endwith %} {% endif %}