{% extends "base.html" %}
{% load translations %}
{% load url from future %}
{% load i18n %}

{% block breadcrumbs %}
<li><a href="{{ object.subproject.project.get_absolute_url }}">{{ object.subproject.project }}</a></li>
<li><a href="{{ object.subproject.get_absolute_url }}">{{ object.subproject.name }}</a></li>
<li><a href="{{ object.get_absolute_url }}">{{ object.language }}</a></li>
{% endblock %}

{% block content %}

{% include "show-lock.html" %}

<h2>{% trans "Project Information" %}</h2>

{% include "translation_info.html" %}

{% with object.get_translation_checks as checks%}
{% if checks %}
<h2>{% trans "Strings to check" %}</h2>
<ul>
{% for c in checks %}
<li><a href="{{ object.get_translate_url }}?type={{ c.0 }}">{{ c.1 }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}

<h2>{% trans "Tools" %}</h2>

<div class="tabs" id="translation-tabs">
<ul>
<li><a href="#changes">{% trans "Recent changes" %}</a></li>
<li><a href="#search">{% trans "Search" %}</a></li>
<li><a href="#files">{% trans "Files" %}</a></li>
{% if autoform %}
<li><a href="#auto">{% trans "Automatic translation" %}</a></li>
{% endif %}
{% if perms.trans.commit_translation or perms.trans.update_translation %}
<li><a href="{% url 'weblate.trans.views.git_status_translation' project=object.subproject.project.slug subproject=object.subproject.slug lang=object.language.code %}">{% trans "Git maintenance" %}</a></li>
{% endif %}
<li><a href="#locking">{% trans "Locking" %}</a></li>
<li><a href="#share">{% trans "Share" %}</a></li>
</ul>

<div id="search">
<form action="{{ object.get_translate_url }}" method="GET">
{{ search_form.as_p }}
<input type="submit" value="{% trans "Search" %}" class="button" />
</form>
</div>

<div id="files">

<h3>{% trans "Download" %}</h3>
{% with object.get_download_url as download_url %}
<p>{% blocktrans %}You can <a href="{{ download_url }}">download</a> file for offline translation.{% endblocktrans %}</p>
{% endwith %}

{% if perms.trans.upload_translation %}
<h3>{% trans "Upload" %}</h3>
{% if perms.trans.overwrite_translation %}
<p>{% trans "Uploaded file will be merged with current translation. In case you want to overwrite already translated strings, don't forget to enable it." %}</p>
{% else %}
<p>{% trans "Uploaded file will be merged with current translation." %}</p>
{% endif %}

<form action="{% url 'weblate.trans.views.upload_translation' project=object.subproject.project.slug subproject=object.subproject.slug lang=object.language.code %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<p><input type="submit" value="{% trans "Upload" %}" class="button" /></p>
</form>
{% endif %}
</div>

<div id="changes">

<h3>{% trans "Recent changes" %}</h3>
{% include "last-changes.html" %}

{% if review_form %}
<h3>{% trans "Review" %}</h3>

<p>{% trans "Review translations touched by other users." %}</p>
<form action="{{ object.get_translate_url }}" method="GET">
<table>
{{ review_form.as_table }}
</table>
<p><input type="submit" value="{% trans "Start review" %}" class="button" /></p>
</form>
{% endif %}
</div>

{% if autoform %}
<div id="auto">
<p>{% trans "Automatic translation takes existing translations in this project and applies it to the current subproject. It can be used to push translations to a different branch, to fix inconsistent translations or to translate new subproject using translation memory." %}</p>
<form action="{% url 'weblate.trans.views.auto_translation' project=object.subproject.project.slug subproject=object.subproject.slug lang=object.language.code %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
<table>
{{ autoform.as_table }}
</table>
<p><input type="submit" value="{% trans "Process" %}" class="button" /></p>
</form>
</div>
{% endif %}

<div id="locking">
<p>{% trans "Locking the translation will prevent others to work on translation." %}</p>
{% if object.is_user_locked %}
<p>{% trans "Locked by:" %} {{ object.get_lock_user_display }}</p>
<p>{% trans "Lock expires:" %} {{ object.lock_time|naturaltime }}</p>
{% else %}
<p>{% trans "Translation is currently not locked." %}</p>
{% endif %}
{% if perms.trans.lock_translation %}
{% if object.lock_user == request.user %}
<a class="button" href="{% url 'weblate.trans.views.unlock_translation' project=object.subproject.project.slug subproject=object.subproject.slug lang=object.language.code %}">{% trans "Unlock" %}</a>
{% elif not object.is_user_locked %}
<a class="button" href="{% url 'weblate.trans.views.lock_translation' project=object.subproject.project.slug subproject=object.subproject.slug lang=object.language.code %}">{% trans "Lock" %}</a>
{% endif %}
{% endif %}
</div>

<div id="share">
{% url 'weblate.trans.widgets.widgets' project=object.subproject.project.slug as widgets_url %}
{% url 'weblate.trans.views.data_project' project=object.subproject.project.slug as data_url %}
{% include 'share.html' %}
</div>

</div>

{% endblock %}


