{% extends "wagtailadmin/generic/index.html" %}
{% load i18n %}

{% block listing %}
    <div class="nice-padding">
        {% if languages %}
            <div id="sites-list">
                <table class="listing">
                    <thead>
                        <tr>
                            <th>{% trans "Name" %}</th>
                            <th>{% trans "Code" %}</th>
                            <th>{% trans "Position" %}</th>
                            <th>{% trans "Default" %}</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for language in languages %}
                            <tr>
                                <td class="title">
                                    <a href="{% url 'wagtailtrans_languages:edit' language.id %}">{{ language.get_code_display }}</a>
                                </td>
                                <td class="title">{{ language.code }}</td>
                                <td>{{ language.position }}</td>
                                <td class="title">
                                {% if language.is_default %}
                                    {% trans 'Yes' %}
                                {% endif %}
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>

            </div>
        {% else %}
            {% url 'wagtailtrans_languages:add' as add_language_url %}
            <p>{% blocktrans %}No languages have been created. Why not <a href="{{ add_language_url }}">add one</a>?{% endblocktrans %}</p>
        {% endif %}
    </div>
{% endblock %}
