{% 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>
<li><a href="{{ object.get_absolute_url }}">{{ object.name }}</a></li>
{% endblock %}

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

{% if object.can_add_language and 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-primary">
  <div class="panel-heading"><h4 class="panel-title">{% trans "Start new translation" %}</h4></div>
  <div class="panel-body">
{% if object.new_lang == 'url' %}
<p><a href="{{ object.project.instructions }}">{% 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' %}
<p>{% trans "Project maintainers are notified of this request, which prompts them to add the language manually." %}</p>
{% endif %}
{{ form|crispy }}
<p class="help-block"><a href="{% url 'contact' %}?t=lang">{% trans "Can't find your language in the list above?" %}</a></p>
</div>
<div class="panel-footer">
{% if object.new_lang == 'contact' %}
<input class="btn btn-default" type="submit" value="{% trans "Request new translation" %}" />
{% else %}
<input class="btn btn-default" type="submit" value="{% trans "Start new translation" %}" />
{% endif %}
{% endif %}
</div>
</div>
</form>

</div>
{% endif %}

{% endblock %}
