{% load i18n %}
{% if media_files %}
    {% if is_searching %}
        <h2>
        {% blocktrans count counter=media_files.paginator.count %}
            There is one match
        {% plural %}
            There are {{ counter }} matches
        {% endblocktrans %}
        </h2>
    {% else %}
        <h2>{% trans "Latest media" %}</h2>
    {% endif %}

    {% include "wagtailmedia/media/list.html" with choosing=1 %}

    {% include "wagtailadmin/shared/pagination_nav.html" with items=media_files linkurl=chooser_url %}
{% else %}
    {% if is_searching %}
        <p>{% blocktrans %}Sorry, no media files match "<em>{{ query_string }}</em>"{% endblocktrans %}</p>
    {% else %}
        {% if media_type %}
            {% url 'wagtailmedia:add' media_type as wagtailmedia_add_url %}
        {% else %}
            {% url 'wagtailmedia:add' 'media' as wagtailmedia_add_url %}
        {% endif %}
        {% if current_collection %}
            <p>{% blocktrans %}You haven't uploaded any media in this collection. Why not <a href="{{ wagtailmedia_add_url }}">upload one now</a>?{% endblocktrans %}</p>
        {% else %}
            <p>{% blocktrans %}You haven't uploaded any media. Why not <a href="{{ wagtailmedia_add_url }}">upload one now</a>?{% endblocktrans %}</p>
        {% endif %}
    {% endif %}
{% endif %}
