Skip to content

Banner pointing people to the contributing guide to help us #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 3, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Banner pointing people to the contributing guide to help us
  • Loading branch information
humitos committed May 3, 2020
commit 3079c2788df8b20e8afffd117ece42dbc090f192
23 changes: 23 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,33 @@

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

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

def setup(app):

def add_contributing_banner(app, doctree):
"""
Insert a banner at the top of the index.

This way, we can easily communicate people to help with the translation,
pointing them to different resources.
"""
from docutils import nodes, core

message = '¡Ayúdanos a traducir la documentación oficial de Python al Español! ' \
f'Más información en `Como contribuir </es/{version}/CONTRIBUTING.html>`_'

paragraph = core.publish_doctree(message)[0]
banner = nodes.warning(ids=['contributing-banner'])
banner.append(paragraph)

for document in doctree.traverse(nodes.document):
document.insert(0, banner)

# Change the sourcedir programmatically because Read the Docs always call it with `.`
app.srcdir = 'cpython/Doc'

app.connect('doctree-read', add_contributing_banner)