{% extends "tp_base_extended.html" %}
{% load i18n baseurl store_tags translation_project_tags cache %}
{% get_current_language as LANGUAGE_CODE %}
{% get_current_language_bidi as LANGUAGE_BIDI %}

{% block title %}
{{ block.super }} » {% trans "Translate" %} » {{ store }}
{% endblock %}

{% block body.id %}translatepage{% endblock body.id %}

{% block bodyclass %}{% if checks %}tpreview{% else %}tptranslate{% endif %}{% endblock %}

{% block css %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href='{{ "translate.css"|m }}' />
{% endblock css %}

{% block extra_head %}
<script src='{{ "js/jquery/jquery.textarea-expander.js"|m }}' type="text/javascript"></script>
<script src='{{ "js/jquery/jquery.scrollTo.min.js"|m }}' type="text/javascript"></script>
<script type="text/javascript">
  $(document).ready (function() {
     var maxheight = $(window).height() * 0.3;
     $('textarea.expanding').TextAreaExpander('10', maxheight);
     $.scrollTo('td.translate-full', {offset: {top:-100}});
  });
</script>
{% endblock extra_head %}

{% block search %}
{% render_search search_form "?" %}
{% endblock %}

{% block breadcrumbs_content %}
{% cache settings.CACHE_TIMEOUT store_bread store.id LANGUAGE_CODE %}
{{ block.super }} {% if not directory.trail.count %} » {% endif %}
 <a href="{{ store.pootle_path|l}}/translate">{{ store.name }}</a>
{% endcache %}
{% endblock %}

{% block innernav %}
<!--! Navigation bar -->
<div id="innernav" class="navbar">
  <div class="item-statistics small" lang="{{ LANGUAGE_CODE }}">
    <p> {{ store|stat_summary }}</p>
  </div>
</div><!--innernav-->
{% endblock innernav %}

{% block precontent %}
{{ block.super }}
{% if checks %}
<div class="check">
  {% for check in checks %}
  <p>
    <img src='{{ "images/help.png"|m }}' class="checkinfo" />
    {{ check|safe }}
  </p>
  {% endfor %}
</div>
{% endif %}
{% endblock precontent %}

{% block content %}
<form action="?{{ GET_state }}" method="post" name="translate" id="translate">
{% cache settings.CACHE_TIMEOUT translate_table edit_unit.id store.get_mtime cantranslate cansuggest canreview alt_src_codes unit_rows profile.id LANGUAGE_CODE %}
{% translate_table %}
{% endcache %}
</form>
{% endblock %}

{% block scripts_extra %}
{{ block.super }}
<script src='{{ "js/json2.min.js"|m }}' type="text/javascript"></script>
<script src='{{ "js/translatepage.js"|m }}' type="text/javascript"></script>
<script src='{{ "js/jquery/jquery.cookie.js"|m }}' type="text/javascript"></script>
<script src='{{ "js/jquery/jquery.fieldselection.js"|m }}' type="text/javascript"></script>
<script src='{{ "js/jquery/jquery.caret.js"|m }}' type="text/javascript"></script>
{% if cansuggest or cantranslate %}
  {% for backend, apikey in MT_BACKENDS %}
    {% ifequal backend 'GOOGLE_TRANSLATE' %}
      <script src="{% if request.is_secure %}https://{% else %}http://{% endif %}www.google.com/jsapi" type="text/javascript"></script>
      <script src='{{ "js/mt/google-translate.js"|m }}' type="text/javascript"></script>
    {% endifequal %}
    {% ifequal backend 'APERTIUM' %}
      <script src="http://api.apertium.org/JSLibrary.js{% if apikey %}?key={{ apikey }}{% endif %}" type="text/javascript"></script>
      <script src='{{ "js/mt/apertium.js"|m }}' type="text/javascript"></script>
    {% endifequal %}
  {% endfor %}
{% endif %}
{% endblock scripts_extra %}
