Skip to content

Commit 3079c27

Browse files
committed
Banner pointing people to the contributing guide to help us
1 parent 08b163f commit 3079c27

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

conf.py

+23
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,33 @@
3333

3434
os.system('mkdir -p cpython/locales/es/')
3535
os.system('ln -nfs `pwd` cpython/locales/es/LC_MESSAGES')
36+
os.system('ln -nfs `pwd`/CONTRIBUTING.rst cpython/Doc/CONTRIBUTING.rst')
3637

3738
gettext_compact = False
3839
locale_dirs = ['../locales', 'cpython/locales'] # relative to the sourcedir
3940

4041
def setup(app):
42+
43+
def add_contributing_banner(app, doctree):
44+
"""
45+
Insert a banner at the top of the index.
46+
47+
This way, we can easily communicate people to help with the translation,
48+
pointing them to different resources.
49+
"""
50+
from docutils import nodes, core
51+
52+
message = '¡Ayúdanos a traducir la documentación oficial de Python al Español! ' \
53+
f'Más información en `Como contribuir </es/{version}/CONTRIBUTING.html>`_'
54+
55+
paragraph = core.publish_doctree(message)[0]
56+
banner = nodes.warning(ids=['contributing-banner'])
57+
banner.append(paragraph)
58+
59+
for document in doctree.traverse(nodes.document):
60+
document.insert(0, banner)
61+
4162
# Change the sourcedir programmatically because Read the Docs always call it with `.`
4263
app.srcdir = 'cpython/Doc'
64+
65+
app.connect('doctree-read', add_contributing_banner)

0 commit comments

Comments
 (0)