Skip to content

Commit 7ecf07a

Browse files
committed
Initial commit
0 parents  commit 7ecf07a

File tree

477 files changed

+283419
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

477 files changed

+283419
-0
lines changed

Makefile

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Makefile for es Python Documentation
2+
#
3+
# Here is what you can do:
4+
#
5+
# - make # Automatically build an html local version
6+
# - make todo # To list remaining tasks
7+
# - make merge # To merge pot from upstream
8+
# - make fuzzy # To find fuzzy strings
9+
# - make progress # To compute current progression
10+
# - make upgrade_venv # To upgrade the venv that compiles the doc
11+
#
12+
# Modes are: autobuild-stable, autobuild-dev, and autobuild-html,
13+
# documented in gen/src/3.6/Doc/Makefile as we're only delegating the
14+
# real work to the Python Doc Makefile.
15+
16+
CPYTHON_CLONE := ../cpython/
17+
SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py
18+
LANGUAGE := es
19+
VENV := ~/.venvs/python-docs-i18n/
20+
PYTHON := $(shell which python3)
21+
MODE := html
22+
BRANCH = 3.7
23+
COMMIT =
24+
JOBS = auto
25+
26+
27+
.PHONY: all
28+
all: $(SPHINX_CONF) $(VENV)/bin/activate
29+
ifneq "$(shell cd $(CPYTHON_CLONE) 2>/dev/null && git describe --contains --all HEAD)" "$(BRANCH)"
30+
$(warning "Your ../cpython checkout may be on the wrong branch, got $(shell cd $(CPYTHON_CLONE) 2>/dev/null && git describe --contains --all HEAD) expected $(BRANCH)")
31+
endif
32+
mkdir -p $(CPYTHON_CLONE)/locales/$(LANGUAGE)/
33+
ln -nfs $(shell $(PYTHON) -c 'import os; print(os.path.realpath("."))') $(CPYTHON_CLONE)/locales/$(LANGUAGE)/LC_MESSAGES
34+
$(MAKE) -C $(CPYTHON_CLONE)/Doc/ VENVDIR=$(VENV) PYTHON=$(PYTHON) SPHINXOPTS='-qW -j$(JOBS) -D locale_dirs=../locales -D language=$(LANGUAGE) -D gettext_compact=0 -D latex_engine=xelatex -D latex_elements.inputenc= -D latex_elements.fontenc=' $(MODE)
35+
36+
37+
$(SPHINX_CONF):
38+
git clone --depth 1 --branch $(BRANCH) https://github.com/python/cpython.git $(CPYTHON_CLONE)
39+
[ -n "$(COMMIT)" ] && (i=1; while ! $$(git -C $(CPYTHON_CLONE) checkout $(COMMIT)); do i=$$((i * 2)); git -C $(CPYTHON_CLONE) fetch --depth $$i; done) || true
40+
41+
42+
.PHONY: upgrade_venv
43+
upgrade_venv:
44+
$(MAKE) -C $(CPYTHON_CLONE)/Doc/ VENVDIR=$(VENV) PYTHON=$(PYTHON) venv
45+
46+
47+
$(VENV)/bin/activate:
48+
$(MAKE) -C $(CPYTHON_CLONE)/Doc/ VENVDIR=$(VENV) PYTHON=$(PYTHON) venv
49+
50+
51+
.PHONY: progress
52+
progress:
53+
@python3 -c 'import sys; print("{:.1%}".format(int(sys.argv[1]) / int(sys.argv[2])))' \
54+
$(shell msgcat *.po */*.po | msgattrib --translated | grep -c '^msgid') \
55+
$(shell msgcat *.po */*.po | grep -c '^msgid')
56+
57+
58+
.PHONY: merge
59+
merge: upgrade_venv
60+
ifneq "$(shell cd $(CPYTHON_CLONE) 2>/dev/null && git describe --contains --all HEAD)" "$(BRANCH)"
61+
$(error "You're merging from a different branch:" "$(shell cd $(CPYTHON_CLONE) 2>/dev/null && git describe --contains --all HEAD)" vs "$(BRANCH)")
62+
endif
63+
(cd $(CPYTHON_CLONE)/Doc; rm -f build/NEWS)
64+
(cd $(CPYTHON_CLONE); $(VENV)/bin/sphinx-build -Q -b gettext -D gettext_compact=0 Doc pot/)
65+
find $(CPYTHON_CLONE)/pot/ -name '*.pot' |\
66+
while read -r POT;\
67+
do\
68+
PO="./$$(echo "$$POT" | sed "s#$(CPYTHON_CLONE)/pot/##; s#\.pot\$$#.po#")";\
69+
mkdir -p "$$(dirname "$$PO")";\
70+
if [ -f "$$PO" ];\
71+
then\
72+
case "$$POT" in\
73+
*whatsnew*) msgmerge --backup=off --force-po --no-fuzzy-matching -U "$$PO" "$$POT" ;;\
74+
*) msgmerge --backup=off --force-po -U "$$PO" "$$POT" ;;\
75+
esac\
76+
else\
77+
msgcat -o "$$PO" "$$POT";\
78+
fi\
79+
done
80+
81+
82+
.PHONY: fuzzy
83+
fuzzy:
84+
for file in *.po */*.po; do echo $$(msgattrib --only-fuzzy --no-obsolete "$$file" | grep -c '#, fuzzy') $$file; done | grep -v ^0 | sort -gr

README.rst

Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
Translation of the Python Documentation — es
2+
============================================
3+
4+
.. image:: https://travis-ci.org/python/python-docs-es.svg?branch=3.7
5+
:target: https://travis-ci.org/python/python-docs-es
6+
7+
8+
Documentation Contribution Agreement
9+
------------------------------------
10+
11+
NOTE REGARDING THE LICENSE FOR TRANSLATIONS: Python's documentation is
12+
maintained using a global network of volunteers. By posting this
13+
project on Transifex, Github, and other public places, and inviting
14+
you to participate, we are proposing an agreement that you will
15+
provide your improvements to Python's documentation or the translation
16+
of Python's documentation for the PSF's use under the CC0 license
17+
(available at
18+
https://creativecommons.org/publicdomain/zero/1.0/legalcode). In
19+
return, you may publicly claim credit for the portion of the
20+
translation you contributed and if your translation is accepted by the
21+
PSF, you may (but are not required to) submit a patch including an
22+
appropriate annotation in the Misc/ACKS or TRANSLATORS file. Although
23+
nothing in this Documentation Contribution Agreement obligates the PSF
24+
to incorporate your textual contribution, your participation in the
25+
Python community is welcomed and appreciated.
26+
27+
You signify acceptance of this agreement by submitting your work to
28+
the PSF for inclusion in the documentation.
29+
30+
31+
Contributing to the Translation
32+
-------------------------------
33+
34+
How to Contribute
35+
~~~~~~~~~~~~~~~~~
36+
37+
You can contribute using:
38+
39+
- Github
40+
- `transifex <https://www.transifex.com/python-doc/public/>`_
41+
- Or just by opening `an issue on github <https://github.com/python/python-docs-esfr/issues>`_
42+
43+
44+
Contributing using Github
45+
~~~~~~~~~~~~~~~~~~~~~~~~~
46+
47+
Prerequisites:
48+
49+
- A `github account <https://github.com/join>`_.
50+
- ``git`` `installed <https://help.github.com/articles/set-up-git/>`_ (for windows, see
51+
https://gitforwindows.org/).
52+
- A ``.po`` file editor (Use `poedit <https://poedit.net/>`_
53+
if you don't already have one).
54+
55+
56+
Let's start:
57+
58+
You'll need to fork the `python-docs-es
59+
<https://github.com/python/python-docs-es>`_ clicking its ``Fork``
60+
button. This creates a copy of the whole project on your github
61+
account: a place where you have the rights to do modifications.
62+
63+
Step by step:
64+
65+
.. code-block:: bash
66+
67+
# Git clone your github fork using ssh (replace JulienPalard):
68+
git clone git@github.com:JulienPalard/python-docs-es.git
69+
70+
# Go to the cloned directory:
71+
cd python-docs-es/
72+
73+
# Add the upstream (the public repository) using HTTPS (won't ask for password):
74+
git remote add upstream https://github.com/python/python-docs-es.git
75+
76+
All the translations must be made on the latest release.
77+
We never translate on an oldest version, by example, the latest python release
78+
is python 3.7, we don't want to translate directly on the python 3.5 release.
79+
If needed translations would be backported on the oldest versions by the
80+
`documentation team <https://www.python.org/dev/peps/pep-8015/#documentation-team>`.
81+
82+
Now you're ready to start a work session, each time you'll start a new task, start here:
83+
84+
.. code-block:: bash
85+
86+
# To work, we'll need a branch, based on an up-to-date (freshly fetched)
87+
# upstream/3.7 branch, let's say we'll work on glossary so we name
88+
# the branch "glossary":
89+
git fetch upstream
90+
git checkout -b glossary upstream/3.7
91+
92+
# You can now work on the file, typically using poedit,
93+
poedit directory/file.po
94+
95+
# When everything is clear (syntax errors from Sphinx, html rendering,
96+
# semantics, typography),
97+
# you can commit your work with a nice explicit message:
98+
git commit -a -m "Working on glossary."
99+
100+
# Then push your modifications to your github clone,
101+
# as they are ephemeral branches, let's not configure git to track them all,
102+
# "origin HEAD" is a "special" syntax to say "Push on origin,
103+
# on a branch with the same name as the local one",
104+
# it's nice as it's exactly what we want:
105+
git push origin HEAD
106+
107+
# The previous command will print you a link to open a PR on github.
108+
# If you missed it, just go to
109+
# https://github.com/python/python-docs-es/ and a nice "Compare & pull request"
110+
# button should appear after a few seconds telling you can ask for a pull request.
111+
112+
# Now someone is reviewing your modifications, and you'll want to fix their
113+
# findings, get back to your branch
114+
# (in case you started something else on another branch):
115+
git checkout glossary
116+
# Fix the issues, then commit again:
117+
git commit -a -m "glossary: small fixes."
118+
git push origin HEAD
119+
120+
121+
You may have noted that this looks like a triangle, with a missing segment:
122+
123+
- You're fetching from upstream (public common repo on github)
124+
- You're pushing to origin (your clone on github)
125+
126+
So yes it's the work of someone to add the last segment, from your
127+
origin to the public upstream, to "close the loop", that's the role of
128+
the people who merges pull requests after proofreading them.
129+
130+
You may also have noted you never ever commit on a version branch
131+
(``3.6``, ``3.7``, ...), only pull from them, consider them read-only
132+
you'll avoid problems.
133+
134+
135+
What to translate
136+
~~~~~~~~~~~~~~~~~
137+
138+
You can start with easy tasks like reviewing fuzzy entries to help
139+
keeping the documentation up to date (find them using ``make fuzzy``).
140+
141+
You can also proofread already translated entries, and finally
142+
translate untranslated ones (find them using ``make todo``)..
143+
144+
- Do not translate content of ``:ref:...`` and ``:term:...``
145+
- Put english words, if you have to use them, in *italics* (surrounded
146+
by stars).
147+
- If you translate a link title, please translate the link too
148+
(typically if it's Wikipedia and the article has a translation). If
149+
no translation of the target exists, do not translate the
150+
title.
151+
152+
153+
Where to get help
154+
~~~~~~~~~~~~~~~~~
155+
156+
157+
Translation Resources
158+
---------------------
159+
160+
161+
Glossary
162+
--------
163+
164+
For consistency in our translations, here are some propositions and
165+
reminders for frequent terms you'll have to translate, don't hesitate
166+
to open an issue if you disagree.
167+
168+
To easily find how a term is already translated in our documentation,
169+
you may use
170+
`find_in_po.py <https://gist.github.com/JulienPalard/c430ac23446da2081060ab17bf006ac1>`_.
171+
172+
========================== ===========================================
173+
Term Proposed Translation
174+
========================== ===========================================
175+
-like
176+
abstract data type
177+
argument
178+
backslash
179+
bound
180+
bug
181+
built-in
182+
call stack
183+
debugging
184+
deep copy
185+
double quote
186+
e.g.
187+
garbage collector
188+
identifier
189+
immutable
190+
installer
191+
interpreter
192+
library
193+
list comprehension
194+
little-endian, big-endian
195+
mutable
196+
namespace
197+
parameter
198+
prompt
199+
raise
200+
regular expression
201+
return
202+
simple quote
203+
socket
204+
statement
205+
subprocess
206+
thread
207+
underscore
208+
expression
209+
========================== ===========================================
210+
211+
212+
Simplify git diffs
213+
------------------
214+
215+
Git diffs are often crowded with useless line number changes, like:
216+
217+
.. code-block:: diff
218+
219+
-#: ../Doc/library/signal.rst:406
220+
+#: ../Doc/library/signal.rst:408
221+
222+
To tell git they are not usefull information, you can do the following
223+
after ensuring ``~/.local/bin/`` is in your ``PATH``.
224+
225+
.. code-block:: bash
226+
227+
cat <<EOF > ~/.local/bin/podiff
228+
#!/bin/sh
229+
grep -v '^#:' "\$1"
230+
EOF
231+
232+
chmod a+x ~/.local/bin/podiff
233+
234+
git config diff.podiff.textconv podiff
235+
236+
237+
Maintenance
238+
-----------
239+
240+
All those snippets are to run from the root of a ``python-docs-es``
241+
clone, and some expect to find an up-to-date CPython clone near to it,
242+
like:
243+
244+
.. code-block:: bash
245+
246+
~/
247+
├── python-docs-es/
248+
└── cpython/
249+
250+
To clone CPython you may use:
251+
252+
.. code-block:: bash
253+
254+
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git
255+
256+
This avoids to download the whole history (not usefull to build
257+
documentation) but still fetches all branches.
258+
259+
260+
Merge pot files from CPython
261+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262+
263+
.. code-block:: bash
264+
265+
make merge
266+
267+
268+
Find fuzzy strings
269+
~~~~~~~~~~~~~~~~~~
270+
271+
.. code-block:: bash
272+
273+
make fuzzy
274+
275+
276+
Run a test build locally
277+
~~~~~~~~~~~~~~~~~~~~~~~~
278+
279+
.. code-block:: bash
280+
281+
make
282+
283+
284+
Synchronize translation with Transifex
285+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
286+
287+
You'll need the ``transifex-client`` and ``powrap``
288+
from Pypi.
289+
290+
You'll need to configure ``tx`` via ``tx init`` if not already done.
291+
292+
.. code-block:: bash
293+
294+
pomerge --from-files **/*.po
295+
tx pull -f
296+
pomerge --to-files **/*.po
297+
pomerge --from-files **/*.po
298+
git checkout -- .
299+
pomerge --to-files **/*.po
300+
powrap --modified
301+
git commit -m "tx pull"
302+
tx push -t -f

0 commit comments

Comments
 (0)