Skip to content

Commit 1e84e4c

Browse files
committed
Update guide to merge files from 3.8
1 parent 5a3b65c commit 1e84e4c

File tree

2 files changed

+57
-14
lines changed

2 files changed

+57
-14
lines changed

.overrides/upgrade-python-version.rst

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
=======================================
2+
How to update to a new Python version
3+
=======================================
4+
5+
We are currently in branch 3.7, and we want to update the strings from 3.8.
6+
7+
8+
#. Fetch the `lastet commit of 3.8 branch <https://github.com/python/cpython/commit/70fe95cdc9ac1b00d4f86b7525dca80caf7003e1>`_::
9+
10+
git fetch --depth 1 origin 70fe95cdc9ac1b00d4f86b7525dca80caf7003e1
11+
12+
#. Checkout that commit locally::
13+
14+
git checkout 70fe95cdc9ac1b00d4f86b7525dca80caf7003e1
15+
16+
#. Create the .po files from the new source code. This will generate all the .po files for version 3.8::
17+
18+
SPHINX_GETTEXT=True sphinx-build -j auto -b gettext -d _build/doctrees . ../pot
19+
20+
#. Now we have to merge our current translation .po files with the new .po files that come from upstream::
21+
22+
pomerge --from-files **/*.po --to-files ../pot/**/*.pot
23+
24+
.. note::
25+
26+
In ../pot, we will have the new .pot files with new strings from 3.8 branch,
27+
with all the translations from our current 3.7 branch.
28+
If there wasn't a translation found, it is left unstranlated.
29+
30+
#. Remove `python-docs-cpython/` prefix::
31+
32+
sed -i **/*.pot -e "s|python-docs-es/cpython/||g"
33+
34+
#. Rename all the .pot files to .po files::
35+
36+
#. Move all the newly pot files created to our repository::

conf.py

+21-14
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,21 @@
3535
os.system('ln -nfs `pwd` cpython/locales/es/LC_MESSAGES')
3636

3737

38-
# Override all the files from ``.overrides`` directory
39-
import glob
40-
for root, dirs, files in os.walk('.overrides'):
41-
for fname in files:
42-
if fname == 'README.rst' and root == '.overrides':
43-
continue
44-
destroot = root.replace('.overrides', '').lstrip('/')
45-
outputdir = os.path.join(
46-
'cpython',
47-
'Doc',
48-
destroot,
49-
fname,
50-
)
51-
os.system(f'ln -nfs `pwd`/{root}/{fname} {outputdir}')
38+
if not os.environ.get('SPHINX_GETTEXT') == 'True':
39+
# Override all the files from ``.overrides`` directory
40+
import glob
41+
for root, dirs, files in os.walk('.overrides'):
42+
for fname in files:
43+
if fname == 'README.rst' and root == '.overrides':
44+
continue
45+
destroot = root.replace('.overrides', '').lstrip('/')
46+
outputdir = os.path.join(
47+
'cpython',
48+
'Doc',
49+
destroot,
50+
fname,
51+
)
52+
os.system(f'ln -nfs `pwd`/{root}/{fname} {outputdir}')
5253

5354
gettext_compact = False
5455
locale_dirs = ['../locales', 'cpython/locales'] # relative to the sourcedir
@@ -62,6 +63,12 @@ def add_contributing_banner(app, doctree):
6263
This way, we can easily communicate people to help with the translation,
6364
pointing them to different resources.
6465
"""
66+
67+
if app.builder.format != 'html':
68+
# Do not include the banner when building with other formats
69+
# (this is useful when using -b gettext)
70+
return
71+
6572
from docutils import nodes, core
6673

6774
message = '¡Ayúdanos a traducir la documentación oficial de Python al Español! ' \

0 commit comments

Comments
 (0)