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

{% block breadcrumbs %}
<li><a href="{{ object.get_absolute_url }}">{{ object }}</a></li>
<li><a href="{% url 'data_project' project=object.slug %}">{% trans "data exports" %}</a></li>
{% endblock %}

{% block content %}

<p>
{% trans "You can retrieve various data from Weblate in machine readable format." %}
</p>

<h3>{% trans "RSS feeds" %}</h3>

<p>
{% trans "To follow translation progress you can use RSS feeds which include all important changes in translation." %}
{% blocktrans %}More information about exported RSS feeds is available in <a href="{{ rss_docs }}">the documentation</a>.{% endblocktrans %}
</p>

<table class="table">
<thead>
<tr>
<th>{% trans "Project" %}</th>
<th>{% trans "URL" %}</th>
<th>{% trans "Link" %}</th>
</thead>
<tbody>
<tr>
<th>{{ object }}</th>
<td>{{ site_url }}{% url 'rss-project' project=object.slug %}</td>
<td><a href="{{ site_url }}{% url 'rss-project' project=object.slug %}">{% trans "RSS" %}</a></td>
</tr>
{% for subproject in object.subproject_set.all %}
<tr>
<th>{{ subproject }}</th>
<td>{{ site_url }}{% url 'rss-subproject' project=object.slug subproject=subproject.slug %}</td>
<td><a href="{{ site_url }}{% url 'rss-subproject' project=object.slug subproject=subproject.slug %}">{% trans "RSS" %}</a></td>
</tr>
{% endfor %}
</tbody>
</table>

<p>{% trans "There are also per language RSS feeds available, you can construct them by appending a language code to the above URLs." %}</p>

<h3>{% trans "Statistics" %}</h3>

<p>
{% blocktrans %}Translation statistics for every component in the JSON format allow you to use these data in other websites or tools. Format of the data is described in <a href="{{ api_docs }}">the documentation</a>.{% endblocktrans %}
</p>

<table class="table">
<thead>
<tr>
<th>{% trans "Project" %}</th>
<th>{% trans "URL" %}</th>
<th>{% trans "Link" %}</th>
</thead>
<tbody>
{% for subproject in object.subproject_set.all %}
<tr>
<th>{{ subproject }}</th>
<td>{{ site_url }}{% url 'api:component-statistics' project__slug=object.slug slug=subproject.slug %}</td>
<td><a href="{{ site_url }}{% url 'api:component-statistics' project__slug=object.slug slug=subproject.slug %}">{% trans "View" %}</a></td>
</tr>
{% endfor %}
</tbody>
</table>

{% with object.subproject_set.all.0 as subproject %}
{% if subproject %}
<p>{% trans "For example getting stats for all translations in one component can be done by:" %}</p>

<pre>
curl \
    -H "Authorization: Token {{ request.user.auth_token.key|default:"TOKEN" }}" \
    {{ site_url }}{% url 'api:component-translations' project__slug=object.slug slug=subproject.slug %}
</pre>
{% endif %}
{% endwith %}

{% if hooks_enabled and project.enable_hooks %}
<h3>{% trans "Notification hooks" %}</h3>

<p>
{% blocktrans %}With notification hooks, Weblate will automatically import changes done by your developers and will allow continuous translation. More information is available in <a href="{{ hooks_docs }}">the documentation</a>.{% endblocktrans %}
</p>
{% endif %}

<table class="table">
<thead>
<tr>
<th>{% trans "Project" %}</th>
<th>{% trans "URL" %}</th>
<th>{% trans "Link" %}</th>
</thead>
<tbody>
<tr>
<th>{{ object }}</th>
<td>{{ site_url }}{% url 'api:project-repository' slug=object.slug %}</td>
<td><a href="{{ site_url }}{% url 'api:project-repository' slug=object.slug %}">{% trans "Hook" %}</a></td>
</tr>
{% for subproject in object.subproject_set.all %}
<tr>
<th>{{ subproject }}</th>
<td>{{ site_url }}{% url 'api:component-repository' project__slug=object.slug slug=subproject.slug %}</td>
<td><a href="{{ site_url }}{% url 'api:component-repository' project__slug=object.slug slug=subproject.slug %}">{% trans "Hook" %}</a></td>
</tr>
{% endfor %}
</tbody>
</table>

<p>{% trans "For example telling Weblate to pull remote repository can be done by:" %}</p>

<pre>
curl \
    -d operation=pull \
    -H "Authorization: Token {{ request.user.auth_token.key|default:"TOKEN" }}" \
    {{ site_url }}{% url 'api:project-repository' slug=object.slug %}
</pre>

<p>{% blocktrans %}Weblate also supports direct notification from several code hosting sites:{% endblocktrans %}</p>

<table class="table">
<thead>
<tr>
<th>{% trans "Hosting site" %}</th>
<th>{% trans "URL" %}</th>
<th>{% trans "Note" %}</th>
</tr>
</thead>
<tbody>
<tr>
<th><a href="https://github.com/">GitHub</a></th>
<td>{{ site_url }}{% url 'hook-github' %}</td>
<td><a href="{% documentation "admin/continuous" "github-setup" %}">{% trans "See documentation for detailed instructions" %}</a></td>
</tr>
<tr>
<th><a href="https://about.gitlab.com/">GitLab</a></th>
<td>{{ site_url }}{% url 'hook-gitlab' %}</td>
<td><a href="{% documentation "admin/continuous" "gitlab-setup" %}">{% trans "See documentation for detailed instructions" %}</a></td>
</tr>
<tr>
<th><a href="https://bitbucket.org/">Bitbucket</a></th>
<td>{{ site_url }}{% url 'hook-bitbucket' %}</td>
<td><a href="{% documentation "admin/continuous" "bitbucket-setup" %}">{% trans "See documentation for detailed instructions" %}</a></td>
</tr>
</tbody>
</table>


{% endblock %}
