{% extends "base.html" %}
{% load i18n %}
{% load permissions %}
{% load translations %}
{% load crispy_forms_tags %}

{% block breadcrumbs %}
<li><a href="{{ object.project.get_absolute_url }}">{{ object.project }}</a></li>
{% include "snippets/component-breadcrumb.html" %}
{% endblock %}

{% block content %}
{% perm 'translation.add' object as user_can_add_translation %}
{% perm 'translation.add_more' object as user_can_add_more_translation %}

{% if user_can_add_translation %}

<div class="tab-pane" id="newlang">

<form action="{% url 'new-language' project=object.project.slug component=object.slug %}" method="post">
{% csrf_token %}
<div class="panel panel-default">
  <div class="panel-heading"><h4 class="panel-title">{% trans "Start new translation" %}</h4></div>
  <div class="panel-body">
{% if object.new_lang == 'url' and not can_add %}
<p><a href="{% url 'project' project=object.project.slug %}#information">{% trans "Information on how to start translating into another language is to be found in the translator instructions." %}</a></p>
{% else %}
<p>{% trans "Please choose the language you want to translate to." %}</p>
{% if object.new_lang == 'contact' and not can_add %}
<p>{% trans "Project maintainers are notified of this request, which prompts them to add the language manually." %}</p>
{% endif %}
{{ form|crispy }}
{% if user_can_add_more_translation %}
  <p class="help-block"><a href="{% url 'contact' %}?t=lang">{% trans "Can't find your language in the list above?" %}</a></p>
{% else %}
  <p class="help-block">{% trans "This list includes only basic languages. Please contact project maintainers for adding another one." %}</p>
{% endif %}
</div>
<div class="panel-footer">
{% if object.new_lang == 'contact' %}
<input class="btn btn-primary" type="submit" value="{% trans "Request new translation" %}" />
{% else %}
<input class="btn btn-primary" type="submit" value="{% trans "Start new translation" %}" />
{% endif %}
{% endif %}
</div>
</div>
</form>

</div>
{% endif %}

{% endblock %}
