Skip to content

Commit 42593ad

Browse files
Wrap commands.rst and fix warning (#121)
* Wrap commands.rst and remove default commen in index.rst * Fix Furo warning * Clean up
1 parent 1c0d850 commit 42593ad

File tree

2 files changed

+43
-27
lines changed

2 files changed

+43
-27
lines changed

docs/commands.rst

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
Commands for maintaining language repository
33
============================================
44

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.
67

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.
810

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.
1313

1414

1515
Clone CPython repository
1616
------------------------
1717

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.
1920

2021
From inside your language repository, run:
2122

@@ -26,7 +27,9 @@ From inside your language repository, run:
2627
2728
``--depth 1`` do a shallow clone, which avoid downloading all the 800 MB of data from CPython's repository.
2829

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.
3033

3134

3235
Install requirements
@@ -35,7 +38,8 @@ Install requirements
3538
Creating virtual environment
3639
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3740

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:
3943

4044
.. code-block:: shell
4145
@@ -65,15 +69,21 @@ Install the Transifex CLI client, required to interact with Transifex:
6569
curl -s -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh
6670
cd ../..
6771
68-
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.
6975

7076

7177
Updating the translations
7278
-------------------------
7379

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.
7582

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.
7787

7888
Generating pot files
7989
^^^^^^^^^^^^^^^^^^^^
@@ -100,9 +110,11 @@ Having the pot files, make use of sphinx-intl to generate the .tx/config:
100110
--transifex-project-name=python-newest \
101111
--locale-dir . --pot-dir pot
102112
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.
104115

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:
106118

107119
.. code-block:: shell
108120
@@ -155,11 +167,15 @@ The following commands are recommended for committing and pushing your translati
155167
git add $(git ls-files -o --exclude-standard *.po **/*.po) .tx/config
156168
git diff-index --quiet HEAD || { git commit -m "Update translations" && git push; }
157169
158-
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).
159173

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.
161176

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.
163179

164180
The last command will only commit and push if any file was git-added in the above commands.
165181

@@ -194,7 +210,8 @@ Finally, build using the Makefile from CPython's Doc directory. Here is an expla
194210
Viewing the documentation in a web browser
195211
-----------------------------------------
196212

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:
198215

199216
.. code-block:: shell
200217
@@ -206,7 +223,8 @@ Notice how index.html could be replaced with any page, e.g. 'library/os.html'.
206223
Linting the translation files
207224
-----------------------------
208225

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.
210228

211229
.. code-block:: shell
212230
@@ -216,7 +234,9 @@ Linting the translation files
216234
Merging translations into another branch
217235
----------------------------------------
218236

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.
220240

221241
.. code-block:: shell
222242
@@ -226,7 +246,8 @@ This is useful when you want to replicate a translation from the CPython branch
226246
git checkout ${TARGET_BRANCH}
227247
pomerge --to-files *.po **/*.po
228248
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
250+
make sure lines are wrapped:
230251

231252
.. code-block:: shell
232253

docs/index.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
.. Python Docs Transifex Automations documentation master file, created by
2-
sphinx-quickstart on Sun Jan 26 11:03:05 2025.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
5-
61
Python Docs Transifex Automations documentation
7-
================================================
2+
===============================================
83

94
Scripts and procedures for maintaining Python_ documentation translation infrastructure under python-doc_ organization in Transifex_.
105

0 commit comments

Comments
 (0)