Source

pinyomi / pinyin / templates / kana.html

Full commit
{% extends "index.html" %}

{% block javascript %}
<script type="text/javascript">
function searchFocus() {
  document.lookup.query.focus();
}
</script>
{% endblock %}

{% block bodyAttribs %}onLoad="searchFocus()"{% endblock %}

{% load searchResults %}

{% block title %}Chinese-to-Japanese dictionary{% endblock %}

{% block content %}
<h1>Chinese-to-Japanese dictionary (for Japanese speakers)</h1>
<div id="content-main">
  <form name="lookup" action="/{{ prefix }}kana/" method="GET">
    {% if query %}
      <input type="text" name="query" value="{{ query }}" />
    {% else %}
      <input type="text" name="query" />
    {% endif %}
    <input type="submit" class="default" name="action" value="Search"/>
    <input type="submit" name="action" value="Clear"/>
  </form>
  {% if query %}
    <h2>Results</h2>
    {% if error %}
      <div class="error">{{ error }}</div>
    {% endif %}
    {% if results %}
      <p>{{ results|length }} results in {{ time|shortFloat }} seconds.</p>
      <table border="1px">
        <thead>
          <tr>
            <th>Chinese</th>
            <th>Meaning</th>
            <th>Score</th>
          </tr>
        </thead>
        <tbody>
        {% for result in results %}
          <tr class="{% cycle row1,row2 %}">
            <td lang="zh-Hans" xml:lang="zh-Hans">
              {{ result.word }}
{{ result.reading }}            </td>
            <td lang="ja" xml:lang="ja">
              <form action="/{{ prefix }}kana/result/" method="GET">
                <input type="hidden" name="query" value="{{ result.word }}"/>
                <input type="hidden" name="lastLog" value="{{ lastLog }}" />
                <input type="submit" value="Translate" />
              </form>
            </td>
            <td>{{ result.probability|probabilityScore }}</td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    {% else %}
      <em>No matches for the query ({{ time|shortFloat }} seconds).</em>
    {% endif %}
  {% else %}
    <h2>Examples of use</h2>
    <table>
    <thead>
      <th>Input type</th><th>Description</th><th>Example query</th>
      <th>Desired word</th>
    </thead>
    <tbody>
      <tr>
        <td>Chinese</td>
        <td>Type or paste a Chinese word directly to get its meaning.</td>
        <td><a
        href="/{{ prefix }}kana/?query=%E6%97%A5%E6%8A%A5&action=Search&testing=1">日报</a></td>
        <td>日报</td>
      </tr>
      <tr>
        <td>Reading</td>
        <td>If you know how a word is pronounced, use its pinyin to look it up.
        You don't need to know the tones.</td>
        <td><a
        href="/{{ prefix }}kana/?query=faguo&action=Search&testing=1">faguo</a></td>
        <td>法国</td>
      </tr>
      <tr>
        <td>Kanji</td>
        <td>Instead of entering the Chinese characters, you can enter the
        closest possible Japanese kanji.</td>
        <td><a
        href="/{{ prefix }}kana/?query=%E9%9B%BB%E8%A9%B1&action=Search&testing=1">電話</a></td>
        <td>电话</td>
      </tr>
      <tr>
        <td>Kana</td>
        <td>Instead of the kanji above, you can just enter the kana reading. <div style="color:#036">You should separate the reading for each kanji with a space!</div></td>
        <td><a
        href="/{{ prefix }}kana/?query=%E3%81%A7%E3%82%93+%E3%82%8F&action=Search&testing=1">でん わ</a></td>
        <td>电话</td>
      </tr>
    </tbody>
    </table>
  {% endif %}
</div>
{% endblock %}