You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/commands.rst
+42-21Lines changed: 42 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,21 @@
2
2
Commands for maintaining language repository
3
3
============================================
4
4
5
-
This document contains instructions to guide you on managing your language repository, hence helping you to translate Python's documentation to your language.
5
+
This document contains instructions to guide you on managing your language repository, hence helping you to translate
6
+
Python's documentation to your language.
6
7
7
-
These commands are written as in Linux Shell, and should work in Windows Subsystem Linux (WSL), but feel free to use the same logic in other languages e.g. Python.
8
+
These commands are written as in Linux Shell, and should work in Windows Subsystem Linux (WSL), but feel free to use the
9
+
same logic in other languages e.g. Python.
8
10
9
-
Note: Where you see ``${LANGCODE}`` in the commands below, replace it with your language code (e.g. 'uk', 'pt_BR') or set that variable (e.g. ``LANGCODE=pt_BR``) before running the commands.
10
-
11
-
.. contents:: Table of Contents
12
-
:depth: 2
11
+
Note: Where you see ``${LANGCODE}`` in the commands below, replace it with your language code (e.g. 'uk', 'pt_BR') or
12
+
set that variable (e.g. ``LANGCODE=pt_BR``) before running the commands.
13
13
14
14
15
15
Clone CPython repository
16
16
------------------------
17
17
18
-
It is necessary to have a local clone of CPython's source code repository in order to update translation files and to build translated documentation.
18
+
It is necessary to have a local clone of CPython's source code repository in order to update translation files and to
19
+
build translated documentation.
19
20
20
21
From inside your language repository, run:
21
22
@@ -26,7 +27,9 @@ From inside your language repository, run:
26
27
27
28
``--depth 1`` do a shallow clone, which avoid downloading all the 800 MB of data from CPython's repository.
28
29
29
-
Optionally, you could also add ``--no-single-branch`` to git clone command which would make all branches available, allowing to switch between one branch and another. But there is no need if you are working in the translation of a single branch.
30
+
Optionally, you could also add ``--no-single-branch`` to git clone command which would make all branches available,
31
+
allowing to switch between one branch and another. But there is no need if you are working in the translation of a
32
+
single branch.
30
33
31
34
32
35
Install requirements
@@ -35,7 +38,8 @@ Install requirements
35
38
Creating virtual environment
36
39
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37
40
38
-
Optionally, create a virtual environment (short: venv) to keep all Python package installations in it, then activate this venv to make sure commands are run from it:
41
+
Optionally, create a virtual environment (short: venv) to keep all Python package installations in it, then activate
42
+
this venv to make sure commands are run from it:
39
43
40
44
.. code-block:: shell
41
45
@@ -65,15 +69,21 @@ Install the Transifex CLI client, required to interact with Transifex:
Note: the above statements cause ``tx`` binary to be downloaded into .venv/bin directory. Feel free to install this tool wherever you want, but preferably in a directory already in the PATH so that issuing ``tx`` works without its full path.
72
+
Note: the above statements cause ``tx`` binary to be downloaded into .venv/bin directory. Feel free to install this
73
+
tool wherever you want, but preferably in a directory already in the PATH so that issuing ``tx`` works without its
74
+
full path.
69
75
70
76
71
77
Updating the translations
72
78
-------------------------
73
79
74
-
For language teams that coordinate translation efforts in Transifex, updating translation means pulling the translation strings.
80
+
For language teams that coordinate translation efforts in Transifex, updating translation means pulling the translation
81
+
strings.
75
82
76
-
Recommended: Before pulling translations, consider updating the .tx/config to have an up-to-date mapping of project/resources. For this, it is required to generate the documentation's pot files (template of po files), so start with the pot. Alternatively, you can skip it and pull translations, but new translation resources in Transifex could be not mapped, hence wouldn't be pulled.
83
+
Recommended: Before pulling translations, consider updating the .tx/config to have an up-to-date mapping of
84
+
project/resources. For this, it is required to generate the documentation's pot files (template of po files),
85
+
so start with the pot. Alternatively, you can skip it and pull translations, but new translation resources in Transifex
86
+
could be not mapped, hence wouldn't be pulled.
77
87
78
88
Generating pot files
79
89
^^^^^^^^^^^^^^^^^^^^
@@ -100,9 +110,11 @@ Having the pot files, make use of sphinx-intl to generate the .tx/config:
100
110
--transifex-project-name=python-newest \
101
111
--locale-dir . --pot-dir pot
102
112
103
-
This step should take some time to finish. Once it is done, there should be a cpython/Doc/locales/.tx/config containing the list of resources based on the pot files previously generated.
113
+
This step should take some time to finish. Once it is done, there should be a cpython/Doc/locales/.tx/config containing
114
+
the list of resources based on the pot files previously generated.
104
115
105
-
As a final touch, we copy the .tx/config into the language repository making proper tweaks so one can download translations from Transifex or upload local translation changes, all this from repository's root directory:
116
+
As a final touch, we copy the .tx/config into the language repository making proper tweaks so one can download
117
+
translations from Transifex or upload local translation changes, all this from repository's root directory:
106
118
107
119
.. code-block:: shell
108
120
@@ -155,11 +167,15 @@ The following commands are recommended for committing and pushing your translati
It is not recommended to simply "git add" (stage) all PO files because this would also staged and commit the translation files that have only irrelevant changes in their POT-Creation-Date header field (i.e. date when the PO was updated against the POT).
170
+
It is not recommended to simply "git add" (stage) all PO files because this would also staged and commit the translation
171
+
files that have only irrelevant changes in their POT-Creation-Date header field (i.e. date when the PO was updated against
172
+
the POT).
159
173
160
-
The first command first git-add modified tracked files that does **not** exclusively match changes in POT-Creation-Date header, hence relevant changes are included.
174
+
The first command first git-add modified tracked files that does **not** exclusively match changes in POT-Creation-Date
175
+
header, hence relevant changes are included.
161
176
162
-
The second command will git-add untracked po files that may have been newly created on the latest 'tx pull' run. It also adds .tx/config file.
177
+
The second command will git-add untracked po files that may have been newly created on the latest 'tx pull' run. It also
178
+
adds .tx/config file.
163
179
164
180
The last command will only commit and push if any file was git-added in the above commands.
165
181
@@ -194,7 +210,8 @@ Finally, build using the Makefile from CPython's Doc directory. Here is an expla
194
210
Viewing the documentation in a web browser
195
211
-----------------------------------------
196
212
197
-
Just build translated documentation and then open in the browser, no secrets. See below a one-line command to use your default web browser to open the index.html:
213
+
Just build translated documentation and then open in the browser, no secrets. See below a one-line command to use your
214
+
default web browser to open the index.html:
198
215
199
216
.. code-block:: shell
200
217
@@ -206,7 +223,8 @@ Notice how index.html could be replaced with any page, e.g. 'library/os.html'.
206
223
Linting the translation files
207
224
-----------------------------
208
225
209
-
``sphinx-lint`` is great to spot translation errors that will didn't spot e.g. trailing whitespace in the string, reST directive not properly surrounded with whitespace, etc. It's highly recommended.
226
+
``sphinx-lint`` is great to spot translation errors that will didn't spot e.g. trailing whitespace in the string, reST
227
+
directive not properly surrounded with whitespace, etc. It's highly recommended.
210
228
211
229
.. code-block:: shell
212
230
@@ -216,7 +234,9 @@ Linting the translation files
216
234
Merging translations into another branch
217
235
----------------------------------------
218
236
219
-
This is useful when you want to replicate a translation from the CPython branch currently being translated to another older branch. E.g. 3.12 is currently being translated, but 3.11 has that same string and could make use of the translation contributed.
237
+
This is useful when you want to replicate a translation from the CPython branch currently being translated to another
238
+
older branch. E.g. 3.12 is currently being translated, but 3.11 has that same string and could make use of the
239
+
translation contributed.
220
240
221
241
.. code-block:: shell
222
242
@@ -226,7 +246,8 @@ This is useful when you want to replicate a translation from the CPython branch
226
246
git checkout ${TARGET_BRANCH}
227
247
pomerge --to-files *.po **/*.po
228
248
229
-
After the above command, the translation from the current branch were applied to the previous branch "3.11". Now, let's make sure lines are wrapped:
249
+
After the above command, the translation from the current branch were applied to the previous branch "3.11". Now, let's
0 commit comments