cpython: 72edb81e456b (original) (raw)
Mercurial > cpython
changeset 100055:72edb81e456b 2.7
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. [#25907]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Sat, 23 Jan 2016 12:55:11 +0100 |
parents | 63183596db79 |
children | 18c5c68b6075 |
files | Doc/tools/templates/download.html Doc/tools/templates/indexcontent.html Doc/tools/templates/indexsidebar.html Doc/tools/templates/layout.html |
diffstat | 4 files changed, 134 insertions(+), 93 deletions(-)[+] [-] Doc/tools/templates/download.html 109 Doc/tools/templates/indexcontent.html 78 Doc/tools/templates/indexsidebar.html 22 Doc/tools/templates/layout.html 18 |
line wrap: on
line diff
--- a/Doc/tools/templates/download.html +++ b/Doc/tools/templates/download.html @@ -7,55 +7,96 @@ {% endif %} {% block body %} -
Download Python {{ release }} Documentation
- -{% if last_updated %}Last updated on: {{ last_updated }}.
{% endif %} +{% trans %}Download Python {{ release }} Documentation{% endtrans %}
-To download an archive containing all the documents for this version of -Python in one of various formats, follow one of links in this table. The numbers -in the table are the size of the download files in megabytes.
+{% if last_updated %}{% trans %}Last updated on: {{ last_updated }}.{% endtrans %}
[](#l1.16) +{% endif %}[](#l1.17) +[](#l1.18) +{% trans %}To download an archive containing all the documents for[](#l1.19) +this version of Python in one of various formats, follow one of links[](#l1.20) +in this table. The numbers in the table are the size of the download[](#l1.21) +files in megabytes.{% endtrans %}
[](#l1.22) [](#l1.23)[](#l1.24)
[](#l1.25)Format Packed as .zip Packed as .tar.bz2 PDF (US-Letter paper size) [](#l1.26)Download (ca. 8 MB) [](#l1.27)Download (ca. 8 MB) [](#l1.28)
{% trans %}Format{% endtrans %} [](#l1.29){% trans %}Packed as .zip{% endtrans %} [](#l1.30){% trans %}Packed as .tar.bz2{% endtrans %} [](#l1.31)- [](#l1.32)
{% trans %}PDF (US-Letter paper size){% endtrans %} [](#l1.33)[](#l1.34) <a href="{{ dlbase }}/python-{{ release }}-docs-pdf-letter.zip">[](#l1.35)
{% trans %}Download{% endtrans %}[](#l1.36)
</a> {% trans %}(ca. 8 MB){% endtrans %}[](#l1.37)
- [](#l1.38)
[](#l1.39) <a href="{{ dlbase }}/python-{{ release }}-docs-pdf-letter.tar.bz2">[](#l1.40)
{% trans %}Download{% endtrans %}[](#l1.41)
</a> {% trans %}(ca. 8 MB){% endtrans %}[](#l1.42)
- [](#l1.43)
These archives contain all the content in the documentation.
[](#l1.91) +{% trans %}These archives contain all the content in the[](#l1.92) +documentation.{% endtrans %}
[](#l1.93) [](#l1.94) -HTML Help (.chm) files are made available in the "Windows" section[](#l1.95) -on the Python[](#l1.96) -download page.
[](#l1.97) +{% trans download_page="https://www.python.org/download/releases/{{ release[:5] }}/" %}HTML Help[](#l1.98) +(.chm) files are made available in the "Windows" section[](#l1.99) +on the Python download page.{% endtrans %}
[](#l1.100) [](#l1.101) [](#l1.102) -Unpacking
[](#l1.103) +{% trans %}Unpacking{% endtrans %}
[](#l1.104) [](#l1.105) -Unix users should download the .tar.bz2 archives; these are bzipped tar[](#l1.106) -archives and can be handled in the usual way using tar and the bzip2[](#l1.107) -program. The InfoZIP unzip program can be[](#l1.108) -used to handle the ZIP archives if desired. The .tar.bz2 archives provide the[](#l1.109) -best compression and fastest download times.
[](#l1.110) +{% trans %}Unix users should download the .tar.bz2 archives; these[](#l1.111) +are bzipped tar archives and can be handled in the usual way using tar[](#l1.112) +and the bzip2 program. The InfoZIP unzip[](#l1.113) +program can be used to handle the ZIP archives if desired. The[](#l1.114) +.tar.bz2 archives provide the best compression and fastest download[](#l1.115) +times.{% endtrans %}
[](#l1.116) [](#l1.117) -Windows users can use the ZIP archives since those are customary on that[](#l1.118) -platform. These are created on Unix using the InfoZIP zip program.
[](#l1.119) +{% trans %}Windows users can use the ZIP archives since those are[](#l1.120) +customary on that platform. These are created on Unix using the[](#l1.121) +InfoZIP zip program.{% endtrans %}
[](#l1.122) [](#l1.123) [](#l1.124) -Problems
[](#l1.125) +{% trans %}Problems{% endtrans %}
[](#l1.126) [](#l1.127) -If you have comments or suggestions for the Python documentation, please send[](#l1.128) -email to docs@python.org.
[](#l1.129) +{% trans %}If you have comments or suggestions for the Python[](#l1.130) +documentation, please send email to[](#l1.131) +docs@python.org.{% endtrans %}
[](#l1.132) {% endblock %}[](#l1.133)--- a/Doc/tools/templates/indexcontent.html +++ b/Doc/tools/templates/indexcontent.html @@ -1,59 +1,59 @@ {% extends "defindex.html" %} {% block tables %}
Parts of the documentation:
[](#l2.6)
{% trans %}Parts of the documentation:{% endtrans %}
[](#l2.7)[](#l2.8) [](#l2.9)
<p class="biglink"><a class="biglink" href="{{ pathto("whatsnew/" + version) }}">What's new in Python {{ version }}?</a><br/>[](#l2.10)
<span class="linkdescr">or <a href="{{ pathto("whatsnew/index") }}">all "What's new" documents</a> since 2.0</span></p>[](#l2.11)
<p class="biglink"><a class="biglink" href="{{ pathto("tutorial/index") }}">Tutorial</a><br/>[](#l2.12)
<span class="linkdescr">start here</span></p>[](#l2.13)
<p class="biglink"><a class="biglink" href="{{ pathto("library/index") }}">Library Reference</a><br/>[](#l2.14)
<span class="linkdescr">keep this under your pillow</span></p>[](#l2.15)
<p class="biglink"><a class="biglink" href="{{ pathto("reference/index") }}">Language Reference</a><br/>[](#l2.16)
<span class="linkdescr">describes syntax and language elements</span></p>[](#l2.17)
<p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">Python Setup and Usage</a><br/>[](#l2.18)
<span class="linkdescr">how to use Python on different platforms</span></p>[](#l2.19)
<p class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">Python HOWTOs</a><br/>[](#l2.20)
<span class="linkdescr">in-depth documents on specific topics</span></p>[](#l2.21)
<p class="biglink"><a class="biglink" href="{{ pathto("whatsnew/" + version) }}">{% trans %}What's new in Python {{ version }}?{% endtrans %}</a><br/>[](#l2.22)
<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>[](#l2.23)
<p class="biglink"><a class="biglink" href="{{ pathto("tutorial/index") }}">{% trans %}Tutorial{% endtrans %}</a><br/>[](#l2.24)
<span class="linkdescr">{% trans %}start here{% endtrans %}</span></p>[](#l2.25)
<p class="biglink"><a class="biglink" href="{{ pathto("library/index") }}">{% trans %}Library Reference{% endtrans %}</a><br/>[](#l2.26)
<span class="linkdescr">{% trans %}keep this under your pillow{% endtrans %}</span></p>[](#l2.27)
<p class="biglink"><a class="biglink" href="{{ pathto("reference/index") }}">{% trans %}Language Reference{% endtrans %}</a><br/>[](#l2.28)
<span class="linkdescr">{% trans %}describes syntax and language elements{% endtrans %}</span></p>[](#l2.29)
<p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">{% trans %}Python Setup and Usage{% endtrans %}</a><br/>[](#l2.30)
<span class="linkdescr">{% trans %}how to use Python on different platforms{% endtrans %}</span></p>[](#l2.31)
<p class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">{% trans %}Python HOWTOs{% endtrans %}</a><br/>[](#l2.32)
<span class="linkdescr">{% trans %}in-depth documents on specific topics{% endtrans %}</span></p>[](#l2.33)
[](#l2.34)
<p class="biglink"><a class="biglink" href="{{ pathto("extending/index") }}">Extending and Embedding</a><br/>[](#l2.35)
<span class="linkdescr">tutorial for C/C++ programmers</span></p>[](#l2.36)
<p class="biglink"><a class="biglink" href="{{ pathto("c-api/index") }}">Python/C API</a><br/>[](#l2.37)
<span class="linkdescr">reference for C/C++ programmers</span></p>[](#l2.38)
<p class="biglink"><a class="biglink" href="{{ pathto("install/index") }}">Installing Python Modules</a><br/>[](#l2.39)
<span class="linkdescr">information for installers & sys-admins</span></p>[](#l2.40)
<p class="biglink"><a class="biglink" href="{{ pathto("distutils/index") }}">Distributing Python Modules</a><br/>[](#l2.41)
<span class="linkdescr">sharing modules with others</span></p>[](#l2.42)
<p class="biglink"><a class="biglink" href="{{ pathto("faq/index") }}">FAQs</a><br/>[](#l2.43)
<span class="linkdescr">frequently asked questions (with answers!)</span></p>[](#l2.44)
<p class="biglink"><a class="biglink" href="{{ pathto("extending/index") }}">{% trans %}Extending and Embedding{% endtrans %}</a><br/>[](#l2.45)
<span class="linkdescr">{% trans %}tutorial for C/C++ programmers{% endtrans %}</span></p>[](#l2.46)
<p class="biglink"><a class="biglink" href="{{ pathto("c-api/index") }}">{% trans %}Python/C API{% endtrans %}</a><br/>[](#l2.47)
<span class="linkdescr">{% trans %}reference for C/C++ programmers{% endtrans %}</span></p>[](#l2.48)
<p class="biglink"><a class="biglink" href="{{ pathto("install/index") }}">{% trans %}Installing Python Modules{% endtrans %}</a><br/>[](#l2.49)
<span class="linkdescr">{% trans %}information for installers & sys-admins{% endtrans %}</span></p>[](#l2.50)
<p class="biglink"><a class="biglink" href="{{ pathto("distutils/index") }}">{% trans %}Distributing Python Modules{% endtrans %}</a><br/>[](#l2.51)
<span class="linkdescr">{% trans %}sharing modules with others{% endtrans %}</span></p>[](#l2.52)
<p class="biglink"><a class="biglink" href="{{ pathto("faq/index") }}">{% trans %}FAQs{% endtrans %}</a><br/>[](#l2.53)
[](#l2.55) [](#l2.56) [](#l2.57)<span class="linkdescr">{% trans %}frequently asked questions (with answers!){% endtrans %}</span></p>[](#l2.54)
Indices and tables:
[](#l2.58)
{% trans %}Indices and tables:{% endtrans %}
[](#l2.59)[](#l2.60) [](#l2.61)
<p class="biglink"><a class="biglink" href="{{ pathto("py-modindex") }}">Global Module Index</a><br/>[](#l2.62)
<span class="linkdescr">quick access to all modules</span></p>[](#l2.63)
<p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">General Index</a><br/>[](#l2.64)
<span class="linkdescr">all functions, classes, terms</span></p>[](#l2.65)
<p class="biglink"><a class="biglink" href="{{ pathto("glossary") }}">Glossary</a><br/>[](#l2.66)
<span class="linkdescr">the most important terms explained</span></p>[](#l2.67)
<p class="biglink"><a class="biglink" href="{{ pathto("py-modindex") }}">{% trans %}Global Module Index{% endtrans %}</a><br/>[](#l2.68)
<span class="linkdescr">{% trans %}quick access to all modules{% endtrans %}</span></p>[](#l2.69)
<p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">{% trans %}General Index{% endtrans %}</a><br/>[](#l2.70)
<span class="linkdescr">{% trans %}all functions, classes, terms{% endtrans %}</span></p>[](#l2.71)
<p class="biglink"><a class="biglink" href="{{ pathto("glossary") }}">{% trans %}Glossary{% endtrans %}</a><br/>[](#l2.72)
<span class="linkdescr">{% trans %}the most important terms explained{% endtrans %}</span></p>[](#l2.73)
[](#l2.74)
<p class="biglink"><a class="biglink" href="{{ pathto("search") }}">Search page</a><br/>[](#l2.75)
<span class="linkdescr">search this documentation</span></p>[](#l2.76)
<p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">Complete Table of Contents</a><br/>[](#l2.77)
<span class="linkdescr">lists all sections and subsections</span></p>[](#l2.78)
<p class="biglink"><a class="biglink" href="{{ pathto("search") }}">{% trans %}Search page{% endtrans %}</a><br/>[](#l2.79)
<span class="linkdescr">{% trans %}search this documentation{% endtrans %}</span></p>[](#l2.80)
<p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">{% trans %}Complete Table of Contents{% endtrans %}</a><br/>[](#l2.81)
[](#l2.83) [](#l2.84) [](#l2.85)<span class="linkdescr">{% trans %}lists all sections and subsections{% endtrans %}</span></p>[](#l2.82)
Meta information:
[](#l2.86)
{% trans %}Meta information:{% endtrans %}
[](#l2.87)[](#l2.88) [](#l2.89)
<p class="biglink"><a class="biglink" href="{{ pathto("bugs") }}">Reporting bugs</a></p>[](#l2.90)
<p class="biglink"><a class="biglink" href="{{ pathto("about") }}">About the documentation</a></p>[](#l2.91)
<p class="biglink"><a class="biglink" href="{{ pathto("bugs") }}">{% trans %}Reporting bugs{% endtrans %}</a></p>[](#l2.92)
<p class="biglink"><a class="biglink" href="{{ pathto("about") }}">{% trans %}About the documentation{% endtrans %}</a></p>[](#l2.93)
[](#l2.94)
<p class="biglink"><a class="biglink" href="{{ pathto("license") }}">History and License of Python</a></p>[](#l2.95)
<p class="biglink"><a class="biglink" href="{{ pathto("copyright") }}">Copyright</a></p>[](#l2.96)
<p class="biglink"><a class="biglink" href="{{ pathto("license") }}">{% trans %}History and License of Python{% endtrans %}</a></p>[](#l2.97)
[](#l2.99) [](#l2.100) {% endblock %}[](#l2.101)<p class="biglink"><a class="biglink" href="{{ pathto("copyright") }}">{% trans %}Copyright{% endtrans %}</a></p>[](#l2.98)
--- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -1,17 +1,17 @@ -
Download
- -Docs for other versions
+{% trans %}Download{% endtrans %}
+{% trans %}Download these documents{% endtrans %}
+{% trans %}Docs for other versions{% endtrans %}
- Python 3.4 (stable) [](#l3.11)
- Python 3.5 (in development) [](#l3.12)
- Old versions [](#l3.13)
- {% trans %}Python 3.4 (stable){% endtrans %} [](#l3.14)
- {% trans %}Python 3.5 (in development){% endtrans %} [](#l3.15)
- {% trans %}Old versions{% endtrans %} [](#l3.16)
- PEP Index [](#l3.23)
- Beginner's Guide [](#l3.24)
- Book List [](#l3.25)
- Audio/Visual Talks [](#l3.26)
- {% trans %}PEP Index{% endtrans %} [](#l3.27)
- {% trans %}Beginner's Guide{% endtrans %} [](#l3.28)
- {% trans %}Book List{% endtrans %} [](#l3.29)
- {% trans %}Audio/Visual Talks{% endtrans %} [](#l3.30)
Other resources
[](#l3.19) +{% trans %}Other resources{% endtrans %}
[](#l3.20)- [](#l3.21)
{# XXX: many of these should probably be merged in the main docs #}[](#l3.22)
--- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -6,7 +6,7 @@
<a href="{{ pathto('index') }}">Documentation</a>{{ reldelim1 }}[](#l4.7)
<a href="{{ pathto('index') }}">{% trans %}Documentation{% endtrans %}</a>{{ reldelim1 }}[](#l4.8) {%- else %}[](#l4.9) <a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}[](#l4.10) {%- endif %}[](#l4.11)
@@ -28,24 +28,24 @@ {% endblock %} {% block footer %}
- © Copyright {{ copyright|e }}.
- © {% trans %}Copyright{% endtrans %} {{ copyright|e }}.
- The Python Software Foundation is a non-profit corporation.
- Please donate.
- {% trans %}The Python Software Foundation is a non-profit corporation.{% endtrans %}
- {% trans %}Please donate.{% endtrans %}
- Last updated on {{ last_updated|e }}.
- Found a bug?
- {% trans last_update=last_updated|e %}Last updated on {{ last_update }}.{% endtrans %}
- {% trans pathto_bugs=pathto('bugs') %}Found a bug?{% endtrans %}
- Created using Sphinx {{ sphinx_version|e }}.
- {% trans sphinx_version=sphinx_version|e %}Created using Sphinx {{ sphinx_version }}.{% endtrans %}
{{ _('This Page') }}
[](#l4.35)- [](#l4.36)
- Report a Bug [](#l4.37)
- {% trans %}Report a Bug{% endtrans %} [](#l4.38)
rel="nofollow">Show Source</a></li>[](#l4.40)
rel="nofollow">{% trans %}Show Source{% endtrans %}</a></li>[](#l4.41)