{% extends "rosetta/base.html" %}
{% load i18n %}

{% block title %}{{block.super}} - {% trans "Language selection" %}{% endblock %}

{% block content_subtitle %}: {% trans "Language selection" %}{% endblock %}

{% block breadcrumbs %}
<nav class="" id="grp-breadcrumbs">
    <header style="display:none"><h1>Breadcrumbs</h1></header>
    <ul class="grp-horizontal-list">
        <li><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></li>
        <li> <a href="{% url 'rosetta-pick-file' %}">Rosetta</a></li>
        <li>{% trans "Language selection" %}</li>
    </ul>
</nav>
{% endblock %}


{% block bodyclass %}{% endblock %}
{% block content-class %}change-list content-flexible{% endblock %}

{% block extrahead %}
{{ block.super }}
<script type="text/javascript" charset="utf-8">
    (function($) {
        $(document).ready(function() {
            grappelli.initFilter();
        });
    })(django.jQuery);
</script>
{% endblock %}

{% block main %}
<div class="grp-module grp-changelist-filters">
    <div class="grp-row">
        <div class=g-d-c-fluid>
            <div class=g-d-fluid>

                <!-- PAGINATION TOP -->
                <nav class="grp-pagination">
                    <ul class="pagination">
                        <li class="results"><span>{% blocktrans count counter=languages|length %}{{ counter }} language{% plural %}{{ counter }} languages{% endblocktrans %}</span></li>
                    </ul>
                </nav>
            </div>
            <aside class="g-d-6">
                <!-- FILTERS -->
                <div class="filter g-d-6" id="filters">
                    <div class="grp-pulldown-container">
                        <a class="grp-button grp-pulldown-handler" href="javascript://">{% trans "Filter" %}</a>
                        <ul class="grp-pulldown-content" style="display: none">
                            <li>
                                <label>{% trans "status" %}</label>
                                <select class="grp-filter-choice">
                                    <option value="?filter=project" {% ifequal rosetta_i18n_catalog_filter 'project' %}selected="selected"{% endifequal %}>{% trans "Project" %}</option>
                                    <option value="?filter=third-party" {% ifequal rosetta_i18n_catalog_filter 'third-party' %}selected="selected"{% endifequal %}>{% trans "Third party" %}</option>
                                    <option value="?filter=django" {% ifequal rosetta_i18n_catalog_filter 'django' %}selected="selected"{% endifequal %}>Django</option>
                                    <option value="?filter=all" {% ifequal rosetta_i18n_catalog_filter 'all' %}selected="selected"{% endifequal %}>{% trans "All" %}</option>
                                </select>
                            </li>
                        </ul>
                    </div>
                </div>
            </aside>
        </div>
    </div>
</div>
<form>
    {% if has_pos %}

    {% for lid,language,pos in languages %}
    {% if pos %}
        <div class="container-full grp-module">
            <h2>{{language}}</h2>
            <table cellspacing="0">
                <thead>
                    <tr>
                        <th>{% trans "Application" %}</th>
                        <th class="r">{% trans "Progress"%}</th>
                        <th class="r">{% trans "Messages" %}</th>
                        <th class="r">{% trans "Translated" %}</th>
                        <th class="r">{% trans "Fuzzy"%}</th>
                        <th class="r">{% trans "Obsolete"%}</th>
                        <th>{% trans "File" %}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for app,path,po in pos %}
                    <tr class="{% cycle "row1" "row2" %}">
                        <td><a href="{% url 'rosetta-language-selection' lid forloop.counter0 %}{% if do_django %}?django{% endif %}{% if do_rosetta %}?rosetta{% endif %}">{{ app|title }}</a></td>
                        <td class="ch-progress r">{{po.percent_translated|floatformat:2}}%</td>
                        {% with po.untranslated_entries|length as len_untranslated_entries %}
                        <td class="ch-messages r">{{po.translated_entries|length|add:len_untranslated_entries}}</td>
                        {% endwith %}
                        <td class="ch-translated r">{{po.translated_entries|length}}</td>
                        <td class="ch-fuzzy r">{{po.fuzzy_entries|length}}</td>
                        <td class="ch-obsolete r">{{po.obsolete_entries|length}}</td>
                        <td class="hint">{{ path }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    {% endif %}
    {% endfor %}
    {% else %}
    <h1>{% trans "Nothing to translate!" %}</h1>
    <p>{% trans "You haven't specified any languages in your settings file, or haven't yet generated a batch of translation catalogs." %}</p>
    <p>{% blocktrans with "http://docs.djangoproject.com/en/dev/topics/i18n/#topics-i18n" as i18n_doc_link  %}Please refer to <a href="{{i18n_doc_link}}">Django's I18N documentation</a> for a guide on how to set up internationalization for your project.{% endblocktrans %}</p>
    {% endif %}
</form>
{% endblock %}
