{% if translation_domain is defined %}{% trans_default_domain translation_domain %}{% endif %}
{% if close is not defined %}{% set close = false %}{% endif %}

{% for flashMessage in app.session.flashbag.get('alert') %}
    <div class="alert alert-warning">
        {% if close %}<button type="button" class="close" data-dismiss="alert">&times;</button>{% endif %}
        {{ flashMessage|trans }}
    </div>
{% endfor %}

{% for flashMessage in app.session.flashbag.get('error') %}
    <div class="alert alert-danger">
        {% if close %}<button type="button" class="close" data-dismiss="alert">&times;</button>{% endif %}
        {{ flashMessage|trans }}
    </div>
{% endfor %}

{% for flashMessage in app.session.flashbag.get('info') %}
    <div class="alert alert-info">
        {% if close %}<button type="button" class="close" data-dismiss="alert">&times;</button>{% endif %}
        {{ flashMessage|trans }}
    </div>
{% endfor %}

{% for flashMessage in app.session.flashbag.get('success') %}
    <div class="alert alert-success">
        {% if close %}<button type="button" class="close" data-dismiss="alert">&times;</button>{% endif %}
        {{ flashMessage|trans }}
    </div>
{% endfor %}

{% if translation_domain is not defined %}
    {% set translation_domain = null %}
{% endif %}
{% if close is not defined %}
    {% set close = false %}
{% endif %}

{% for flashMessage in app.session.flashbag.get('alert') %}
    <div class="alert alert-warning">
        {% if close %}<button type="button" class="close" data-dismiss="alert">&times;</button>{% endif %}
        {{ flashMessage|trans({}, translation_domain) }}
    </div>
{% endfor %}

{% for flashMessage in app.session.flashbag.get('error') %}
    <div class="alert alert-danger">
        {% if close %}<button type="button" class="close" data-dismiss="alert">&times;</button>{% endif %}
        {{ flashMessage|trans({}, translation_domain) }}
    </div>
{% endfor %}

{% for flashMessage in app.session.flashbag.get('info') %}
    <div class="alert alert-info">
        {% if close %}<button type="button" class="close" data-dismiss="alert">&times;</button>{% endif %}
        {{ flashMessage|trans({}, translation_domain) }}
    </div>
{% endfor %}

{% for flashMessage in app.session.flashbag.get('success') %}
    <div class="alert alert-success">
        {% if close %}<button type="button" class="close" data-dismiss="alert">&times;</button>{% endif %}
        {{ flashMessage|trans({}, translation_domain) }}
    </div>
{% endfor %}

Add translation_domain to flash template
Add translation_domain to flash template
