diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-01-22 17:00:05 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-01-22 17:00:05 (GMT) |
commit | 875f29aa6901378a64819851f42bc93b2b7647bc (patch) | |
tree | a1941f0e992fc566b25a06419f776f156ece373f /Doc/tools/templates | |
parent | 3cdd5fb970a7d6950b80cc156a9e345f87c179fc (diff) | |
download | cpython-875f29aa6901378a64819851f42bc93b2b7647bc.zip cpython-875f29aa6901378a64819851f42bc93b2b7647bc.tar.gz cpython-875f29aa6901378a64819851f42bc93b2b7647bc.tar.bz2 |
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.
Diffstat (limited to 'Doc/tools/templates')
-rw-r--r-- | Doc/tools/templates/indexcontent.html | 78 | ||||
-rw-r--r-- | Doc/tools/templates/indexsidebar.html | 22 | ||||
-rw-r--r-- | Doc/tools/templates/layout.html | 18 |
3 files changed, 59 insertions, 59 deletions
diff --git a/Doc/tools/templates/indexcontent.html b/Doc/tools/templates/indexcontent.html index 969099a..1076c1f 100644 --- a/Doc/tools/templates/indexcontent.html +++ b/Doc/tools/templates/indexcontent.html @@ -1,59 +1,59 @@ {% extends "defindex.html" %} {% 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> <td width="50%"> - <p class="biglink"><a class="biglink" href="{{ pathto("whatsnew/" + version) }}">What's new in Python {{ version }}?</a><br/> - <span class="linkdescr">or <a href="{{ pathto("whatsnew/index") }}">all "What's new" documents</a> since 2.0</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("tutorial/index") }}">Tutorial</a><br/> - <span class="linkdescr">start here</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("library/index") }}">Library Reference</a><br/> - <span class="linkdescr">keep this under your pillow</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("reference/index") }}">Language Reference</a><br/> - <span class="linkdescr">describes syntax and language elements</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">Python Setup and Usage</a><br/> - <span class="linkdescr">how to use Python on different platforms</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">Python HOWTOs</a><br/> - <span class="linkdescr">in-depth documents on specific topics</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("whatsnew/" + version) }}">{% trans %}What's new in Python {{ version }}?{% endtrans %}</a><br/> + <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") }}">{% trans %}Tutorial{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}start here{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("library/index") }}">{% trans %}Library Reference{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}keep this under your pillow{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("reference/index") }}">{% trans %}Language Reference{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}describes syntax and language elements{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">{% trans %}Python Setup and Usage{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}how to use Python on different platforms{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">{% trans %}Python HOWTOs{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}in-depth documents on specific topics{% endtrans %}</span></p> </td><td width="50%"> - <p class="biglink"><a class="biglink" href="{{ pathto("installing/index") }}">Installing Python Modules</a><br/> - <span class="linkdescr">installing from the Python Package Index & other sources</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("distributing/index") }}">Distributing Python Modules</a><br/> - <span class="linkdescr">publishing modules for installation by others</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("extending/index") }}">Extending and Embedding</a><br/> - <span class="linkdescr">tutorial for C/C++ programmers</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("c-api/index") }}">Python/C API</a><br/> - <span class="linkdescr">reference for C/C++ programmers</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("faq/index") }}">FAQs</a><br/> - <span class="linkdescr">frequently asked questions (with answers!)</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("installing/index") }}">{% trans %}Installing Python Modules{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}installing from the Python Package Index & other sources{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("distributing/index") }}">{% trans %}Distributing Python Modules{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}publishing modules for installation by others{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("extending/index") }}">{% trans %}Extending and Embedding{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}tutorial for C/C++ programmers{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("c-api/index") }}">{% trans %}Python/C API{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}reference for C/C++ programmers{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("faq/index") }}">{% trans %}FAQs{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}frequently asked questions (with answers!){% endtrans %}</span></p> </td></tr> </table> - <p><strong>Indices and tables:</strong></p> + <p><strong>{% trans %}Indices and tables:{% endtrans %}</strong></p> <table class="contentstable" align="center"><tr> <td width="50%"> - <p class="biglink"><a class="biglink" href="{{ pathto("py-modindex") }}">Global Module Index</a><br/> - <span class="linkdescr">quick access to all modules</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">General Index</a><br/> - <span class="linkdescr">all functions, classes, terms</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("glossary") }}">Glossary</a><br/> - <span class="linkdescr">the most important terms explained</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("py-modindex") }}">{% trans %}Global Module Index{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}quick access to all modules{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">{% trans %}General Index{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}all functions, classes, terms{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("glossary") }}">{% trans %}Glossary{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}the most important terms explained{% endtrans %}</span></p> </td><td width="50%"> - <p class="biglink"><a class="biglink" href="{{ pathto("search") }}">Search page</a><br/> - <span class="linkdescr">search this documentation</span></p> - <p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">Complete Table of Contents</a><br/> - <span class="linkdescr">lists all sections and subsections</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("search") }}">{% trans %}Search page{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}search this documentation{% endtrans %}</span></p> + <p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">{% trans %}Complete Table of Contents{% endtrans %}</a><br/> + <span class="linkdescr">{% trans %}lists all sections and subsections{% endtrans %}</span></p> </td></tr> </table> - <p><strong>Meta information:</strong></p> + <p><strong>{% trans %}Meta information:{% endtrans %}</strong></p> <table class="contentstable" align="center"><tr> <td width="50%"> - <p class="biglink"><a class="biglink" href="{{ pathto("bugs") }}">Reporting bugs</a></p> - <p class="biglink"><a class="biglink" href="{{ pathto("about") }}">About the documentation</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") }}">{% trans %}About the documentation{% endtrans %}</a></p> </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("copyright") }}">Copyright</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") }}">{% trans %}Copyright{% endtrans %}</a></p> </td></tr> </table> {% endblock %} diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html index 78e9c4f..bb449ef 100644 --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -1,17 +1,17 @@ -<h3>Download</h3> -<p><a href="{{ pathto('download') }}">Download these documents</a></p> -<h3>Docs for other versions</h3> +<h3>{% trans %}Download{% endtrans %}</h3> +<p><a href="{{ pathto('download') }}">{% trans %}Download these documents{% endtrans %}</a></p> +<h3>{% trans %}Docs for other versions{% endtrans %}</h3> <ul> - <li><a href="https://docs.python.org/2.7/">Python 2.7 (stable)</a></li> - <li><a href="https://docs.python.org/3.4/">Python 3.4 (stable)</a></li> - <li><a href="https://www.python.org/doc/versions/">Old versions</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/">{% trans %}Python 3.4 (stable){% endtrans %}</a></li> + <li><a href="https://www.python.org/doc/versions/">{% trans %}Old versions{% endtrans %}</a></li> </ul> -<h3>Other resources</h3> +<h3>{% trans %}Other resources{% endtrans %}</h3> <ul> {# 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://wiki.python.org/moin/BeginnersGuide">Beginner's Guide</a></li> - <li><a href="https://wiki.python.org/moin/PythonBooks">Book List</a></li> - <li><a href="https://www.python.org/doc/av/">Audio/Visual Talks</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">{% trans %}Beginner's Guide{% endtrans %}</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/">{% trans %}Audio/Visual Talks{% endtrans %}</a></li> </ul> diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html index 8ae6e23..1887b85 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -6,7 +6,7 @@ <li> {%- if versionswitcher is defined %} <span class="version_switcher_placeholder">{{ release }}</span> - <a href="{{ pathto('index') }}">Documentation</a>{{ reldelim1 }} + <a href="{{ pathto('index') }}">{% trans %}Documentation {% endtrans %}</a>{{ reldelim1 }} {%- else %} <a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }} {%- endif %} @@ -79,24 +79,24 @@ {% endblock %} {% block footer %} <div class="footer"> - © <a href="{{ pathto('copyright') }}">Copyright</a> {{ copyright|e }}. + © <a href="{{ pathto('copyright') }}">{% trans %}Copyright{% endtrans %}</a> {{ copyright|e }}. <br /> - The Python Software Foundation is a non-profit corporation. - <a href="https://www.python.org/psf/donations/">Please donate.</a> + {% trans %}The Python Software Foundation is a non-profit corporation.{% endtrans %} + <a href="https://www.python.org/psf/donations/">{% trans %}Please donate.{% endtrans %}</a> <br /> - Last updated on {{ last_updated|e }}. - <a href="{{ pathto('bugs') }}">Found a bug</a>? + {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} + {% trans pathto_bugs=pathto('bugs') %}<a href="{{ pathto_bugs }}">Found a bug</a>?{% endtrans %} <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> {% endblock %} {% block sidebarsourcelink %} {%- if show_source and has_source and sourcename %} <h3>{{ _('This Page') }}</h3> <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 }}" - rel="nofollow">Show Source</a></li> + rel="nofollow">{% trans %}Show Source{% endtrans %}</a></li> </ul> {%- endif %} {% endblock %} |