Commit 875f29aa authored by Victor Stinner's avatar Victor Stinner

doc: i18n HTML templates

Issue #25907: Use {% trans %} tags in HTML templates to ease the translation of
the documentation. The tag comes from Jinja templating system, used by Sphinx.

Patch written by Julien Palard.
parent 3cdd5fb9
{% extends "defindex.html" %} {% extends "defindex.html" %}
{% block tables %} {% block tables %}
<p><strong>Parts of the documentation:</strong></p> <p><strong>{% trans %}Parts of the documentation:{% endtrans %}</strong></p>
<table class="contentstable" align="center"><tr> <table class="contentstable" align="center"><tr>
<td width="50%"> <td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("whatsnew/" + version) }}">What's new in Python {{ version }}?</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("whatsnew/" + version) }}">{% trans %}What's new in Python {{ version }}?{% endtrans %}</a><br/>
<span class="linkdescr">or <a href="{{ pathto("whatsnew/index") }}">all "What's new" documents</a> since 2.0</span></p> <span class="linkdescr"> {% trans whatsnew_index=pathto("whatsnew/index") %}or <a href="{{ whatsnew_index }}">all "What's new" documents</a> since 2.0{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("tutorial/index") }}">Tutorial</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("tutorial/index") }}">{% trans %}Tutorial{% endtrans %}</a><br/>
<span class="linkdescr">start here</span></p> <span class="linkdescr">{% trans %}start here{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("library/index") }}">Library Reference</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("library/index") }}">{% trans %}Library Reference{% endtrans %}</a><br/>
<span class="linkdescr">keep this under your pillow</span></p> <span class="linkdescr">{% trans %}keep this under your pillow{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("reference/index") }}">Language Reference</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("reference/index") }}">{% trans %}Language Reference{% endtrans %}</a><br/>
<span class="linkdescr">describes syntax and language elements</span></p> <span class="linkdescr">{% trans %}describes syntax and language elements{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">Python Setup and Usage</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">{% trans %}Python Setup and Usage{% endtrans %}</a><br/>
<span class="linkdescr">how to use Python on different platforms</span></p> <span class="linkdescr">{% trans %}how to use Python on different platforms{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">Python HOWTOs</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">{% trans %}Python HOWTOs{% endtrans %}</a><br/>
<span class="linkdescr">in-depth documents on specific topics</span></p> <span class="linkdescr">{% trans %}in-depth documents on specific topics{% endtrans %}</span></p>
</td><td width="50%"> </td><td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("installing/index") }}">Installing Python Modules</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("installing/index") }}">{% trans %}Installing Python Modules{% endtrans %}</a><br/>
<span class="linkdescr">installing from the Python Package Index &amp; other sources</span></p> <span class="linkdescr">{% trans %}installing from the Python Package Index &amp; other sources{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("distributing/index") }}">Distributing Python Modules</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("distributing/index") }}">{% trans %}Distributing Python Modules{% endtrans %}</a><br/>
<span class="linkdescr">publishing modules for installation by others</span></p> <span class="linkdescr">{% trans %}publishing modules for installation by others{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("extending/index") }}">Extending and Embedding</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("extending/index") }}">{% trans %}Extending and Embedding{% endtrans %}</a><br/>
<span class="linkdescr">tutorial for C/C++ programmers</span></p> <span class="linkdescr">{% trans %}tutorial for C/C++ programmers{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("c-api/index") }}">Python/C API</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("c-api/index") }}">{% trans %}Python/C API{% endtrans %}</a><br/>
<span class="linkdescr">reference for C/C++ programmers</span></p> <span class="linkdescr">{% trans %}reference for C/C++ programmers{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("faq/index") }}">FAQs</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("faq/index") }}">{% trans %}FAQs{% endtrans %}</a><br/>
<span class="linkdescr">frequently asked questions (with answers!)</span></p> <span class="linkdescr">{% trans %}frequently asked questions (with answers!){% endtrans %}</span></p>
</td></tr> </td></tr>
</table> </table>
<p><strong>Indices and tables:</strong></p> <p><strong>{% trans %}Indices and tables:{% endtrans %}</strong></p>
<table class="contentstable" align="center"><tr> <table class="contentstable" align="center"><tr>
<td width="50%"> <td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("py-modindex") }}">Global Module Index</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("py-modindex") }}">{% trans %}Global Module Index{% endtrans %}</a><br/>
<span class="linkdescr">quick access to all modules</span></p> <span class="linkdescr">{% trans %}quick access to all modules{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">General Index</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">{% trans %}General Index{% endtrans %}</a><br/>
<span class="linkdescr">all functions, classes, terms</span></p> <span class="linkdescr">{% trans %}all functions, classes, terms{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("glossary") }}">Glossary</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("glossary") }}">{% trans %}Glossary{% endtrans %}</a><br/>
<span class="linkdescr">the most important terms explained</span></p> <span class="linkdescr">{% trans %}the most important terms explained{% endtrans %}</span></p>
</td><td width="50%"> </td><td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("search") }}">Search page</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("search") }}">{% trans %}Search page{% endtrans %}</a><br/>
<span class="linkdescr">search this documentation</span></p> <span class="linkdescr">{% trans %}search this documentation{% endtrans %}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">Complete Table of Contents</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">{% trans %}Complete Table of Contents{% endtrans %}</a><br/>
<span class="linkdescr">lists all sections and subsections</span></p> <span class="linkdescr">{% trans %}lists all sections and subsections{% endtrans %}</span></p>
</td></tr> </td></tr>
</table> </table>
<p><strong>Meta information:</strong></p> <p><strong>{% trans %}Meta information:{% endtrans %}</strong></p>
<table class="contentstable" align="center"><tr> <table class="contentstable" align="center"><tr>
<td width="50%"> <td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("bugs") }}">Reporting bugs</a></p> <p class="biglink"><a class="biglink" href="{{ pathto("bugs") }}">{% trans %}Reporting bugs{% endtrans %}</a></p>
<p class="biglink"><a class="biglink" href="{{ pathto("about") }}">About the documentation</a></p> <p class="biglink"><a class="biglink" href="{{ pathto("about") }}">{% trans %}About the documentation{% endtrans %}</a></p>
</td><td width="50%"> </td><td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("license") }}">History and License of Python</a></p> <p class="biglink"><a class="biglink" href="{{ pathto("license") }}">{% trans %}History and License of Python{% endtrans %}</a></p>
<p class="biglink"><a class="biglink" href="{{ pathto("copyright") }}">Copyright</a></p> <p class="biglink"><a class="biglink" href="{{ pathto("copyright") }}">{% trans %}Copyright{% endtrans %}</a></p>
</td></tr> </td></tr>
</table> </table>
{% endblock %} {% endblock %}
<h3>Download</h3> <h3>{% trans %}Download{% endtrans %}</h3>
<p><a href="{{ pathto('download') }}">Download these documents</a></p> <p><a href="{{ pathto('download') }}">{% trans %}Download these documents{% endtrans %}</a></p>
<h3>Docs for other versions</h3> <h3>{% trans %}Docs for other versions{% endtrans %}</h3>
<ul> <ul>
<li><a href="https://docs.python.org/2.7/">Python 2.7 (stable)</a></li> <li><a href="https://docs.python.org/2.7/">{% trans %}Python 2.7 (stable){% endtrans %}</a></li>
<li><a href="https://docs.python.org/3.4/">Python 3.4 (stable)</a></li> <li><a href="https://docs.python.org/3.4/">{% trans %}Python 3.4 (stable){% endtrans %}</a></li>
<li><a href="https://www.python.org/doc/versions/">Old versions</a></li> <li><a href="https://www.python.org/doc/versions/">{% trans %}Old versions{% endtrans %}</a></li>
</ul> </ul>
<h3>Other resources</h3> <h3>{% trans %}Other resources{% endtrans %}</h3>
<ul> <ul>
{# XXX: many of these should probably be merged in the main docs #} {# XXX: many of these should probably be merged in the main docs #}
<li><a href="https://www.python.org/dev/peps/">PEP Index</a></li> <li><a href="https://www.python.org/dev/peps/">{% trans %}PEP Index{% endtrans %}</a></li>
<li><a href="https://wiki.python.org/moin/BeginnersGuide">Beginner's Guide</a></li> <li><a href="https://wiki.python.org/moin/BeginnersGuide">{% trans %}Beginner's Guide{% endtrans %}</a></li>
<li><a href="https://wiki.python.org/moin/PythonBooks">Book List</a></li> <li><a href="https://wiki.python.org/moin/PythonBooks">{% trans %}Book List{% endtrans %}</a></li>
<li><a href="https://www.python.org/doc/av/">Audio/Visual Talks</a></li> <li><a href="https://www.python.org/doc/av/">{% trans %}Audio/Visual Talks{% endtrans %}</a></li>
</ul> </ul>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<li> <li>
{%- if versionswitcher is defined %} {%- if versionswitcher is defined %}
<span class="version_switcher_placeholder">{{ release }}</span> <span class="version_switcher_placeholder">{{ release }}</span>
<a href="{{ pathto('index') }}">Documentation</a>{{ reldelim1 }} <a href="{{ pathto('index') }}">{% trans %}Documentation {% endtrans %}</a>{{ reldelim1 }}
{%- else %} {%- else %}
<a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }} <a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}
{%- endif %} {%- endif %}
...@@ -79,24 +79,24 @@ ...@@ -79,24 +79,24 @@
{% endblock %} {% endblock %}
{% block footer %} {% block footer %}
<div class="footer"> <div class="footer">
&copy; <a href="{{ pathto('copyright') }}">Copyright</a> {{ copyright|e }}. &copy; <a href="{{ pathto('copyright') }}">{% trans %}Copyright{% endtrans %}</a> {{ copyright|e }}.
<br /> <br />
The Python Software Foundation is a non-profit corporation. {% trans %}The Python Software Foundation is a non-profit corporation.{% endtrans %}
<a href="https://www.python.org/psf/donations/">Please donate.</a> <a href="https://www.python.org/psf/donations/">{% trans %}Please donate.{% endtrans %}</a>
<br /> <br />
Last updated on {{ last_updated|e }}. {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
<a href="{{ pathto('bugs') }}">Found a bug</a>? {% trans pathto_bugs=pathto('bugs') %}<a href="{{ pathto_bugs }}">Found a bug</a>?{% endtrans %}
<br /> <br />
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version|e }}. {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
</div> </div>
{% endblock %} {% endblock %}
{% block sidebarsourcelink %} {% block sidebarsourcelink %}
{%- if show_source and has_source and sourcename %} {%- if show_source and has_source and sourcename %}
<h3>{{ _('This Page') }}</h3> <h3>{{ _('This Page') }}</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="{{ pathto('bugs') }}">Report a Bug</a></li> <li><a href="{{ pathto('bugs') }}">{% trans %}Report a Bug{% endtrans %}</a></li>
<li><a href="{{ pathto('_sources/' + sourcename, true)|e }}" <li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
rel="nofollow">Show Source</a></li> rel="nofollow">{% trans %}Show Source{% endtrans %}</a></li>
</ul> </ul>
{%- endif %} {%- endif %}
{% endblock %} {% endblock %}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment