sentence-finder/templates/sentence_finder/index.html

56 lines
3.1 KiB
HTML
Raw Normal View History

2018-10-28 02:00:38 +01:00
{% extends 'base.html' %}
{% load i18n %}
{% load markdown_deux_tags %}
{% block head_title %}{% trans "Find a sentence" %}{% endblock %}
{% block title %}{% trans "Find a sentence" %}{% endblock %}
{% block content %}
<script src='https://code.responsivevoice.org/responsivevoice.js'></script>
<section aria-label="{% trans "Search" %}">
<form method="GET">
{{ search_form.as_p }}
<button>{% trans "Search" %}</button>
</form>
</section>
{% if posts %}
<h2>{% trans "Showing results" %}</h2>
<script type="text/javascript">
responsiveVoice.setDefaultVoice("{{lang}} Female");
</script>
<ul>
{% for post in posts %}
<li><a href="javascript:void(0);" onclick="responsiveVoice.speak('{{ post.phrase|addslashes }}')">{{ post.phrase }}</a></li>
{% endfor %}
</ul>
<div class="pagination">
<span class="step-links">
{% if posts.has_previous %}
<a href="?page=1{{ extra_params }}">{% trans "&laquo; first" %}</a>
<a href="?page={{ posts.previous_page_number }}{{ extra_params }}">{% trans "previous" %}</a>
{% endif %}
<span class="current">
Page {{ posts.number }} of {{ posts.paginator.num_pages }}.
</span>
{% if posts.has_next %}
<a href="?page={{ posts.next_page_number }}{{ extra_params }}">{% trans "next" %}</a>
<a href="?page={{ posts.paginator.num_pages }}{{ extra_params }}">{% trans "last &raquo;" %}</a>
{% endif %}
</span>
</div>
{% else %}
<h2>How it works?</h2>
<p>This simple Django application has been created to help me studying russian sentences and later has been extended to add multiple languages. It works by querying a database wich already contains the complete list of sentences found in the <a href="https://tatoeba.org/">Tatoeba project </a> for the supported languages. Right now, the database contains {{total}} sentences, so things may go slow from time to time once a search has been started. Every page will contain a maximum of 100 sentences, and you can go to the next, previous, first or last page, if there are more than 100 results.</p>
<p>Additionally, you can click in any sentence to hear how it should be spoken.</p>
<h2>Caveats</h2>
<ul><li>Searches are made with "like"statements in the DJango ORM. It means that they are not exact and searching a word may find other similar ones (for example, searching читаю may return sentences including similar words like прочитаю, считаю, читают; searching testing may include results like protesting, etc).</li>
<li>Text to speech is made with the Google Text to Speech engine and should work in All HTML 5 compatible browsers (Firefox and Chrome in windows have been tested, and Chrome in Android).</li></ul>
<h2>Resources</h2>
<p>For this application, I have used the <a href="https://tatoeba.org"/>Tatoeba project</a> for extracting all phrases from their <a href="https://tatoeba.org/downloads">CSV sentence files,</a> and the <a href="https://responsivevoice.org/">responsive voice library</a> for generating a cross platform text to speech result.</p>
{% endif %}
{% endblock %}