Skip to content

Commit 6b0fb48

Browse files
authored
Update how-sync-translations.md
1 parent 0ecd710 commit 6b0fb48

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

data/blog/main/how-sync-translations.md

+22-21
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ date: May 21, 2024
55
tags: translation
66
slug: how-sync-translations
77

8-
One of the challenges of maintaining translations is keeping up with the changes to the original document as the project evolves and new releases are made.
8+
One of the challenges of maintaining different translations of documentation for an open source project is keeping up with the changes to the documentation in its original language as the project evolves and new releases are issued and updates are made.
99

10-
In the case of the Flask documentation, there is the additional challenge of working in separate repositories.
10+
As I learned during a recent open source sprint organized at PyCon US 2024, in the case of Flask’s documentation, there is an additional challenge of working in separate repositories for each language the documentation is translated into.
1111

12-
This post will document a simple process that the contributors and maintainers of the different language translations can use to keep their repositories up to date with the latest version of the Flask English documentation.
12+
This post will document a simple process that the contributors and maintainers of the different language translations can use to keep their repositories up to date with the latest version of Flask’s documentation in English.
1313

1414
## Set up your local environment
1515

16-
First, fork the translation repository for the language you will be working on from the Flask CWG GitHub organization into your personal Github space. If you need, you can find more information about forking in the GitHub documentation [here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo).
16+
First, fork the translation repository for the language you will be working on from the Flask CWG GitHub organization into your personal GitHub space. If you need, you can find more information about forking in the GitHub documentation [here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo).
1717

18-
Once the forked repository is created, clone it on your computer. If you are not familiar with this step, more details are available in the GitHub documentation [here](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository).
18+
Once the forked repository has been created, clone it on your computer. If you are not familiar with this step, more details are available in the GitHub documentation [here](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository).
1919

20-
At this point you will have the latest version of the translation for the language you are working on.
20+
At this point, you will have the latest version of the translation for the language you are working on.
2121

2222
## Add the main Flask repository as a new git remote
2323

24-
A quick note: the command outputs you will see below, show details like tags and commit hashes from the time this post was written, when you execute them, you will probably see different values.
24+
_Quick note: The command outputs you will see below show details like tags and commit hashes from the time this post was written. When you execute them, you will probably see different values._
2525

26-
To access the original English documentation, you will need to set a new git remote repository pointing to the main flask repository:
26+
To access the original English documentation, you will need to set a new git remote repository that points to the main Flask repository:
2727

2828
```shell
2929
$ git remote add flask https://github.com/pallets/flask.git
3030
```
3131

32-
And fetch the data from it.
32+
Then, fetch the data from it.
3333

3434
```shell
3535
$ git fetch flask
@@ -66,21 +66,21 @@ $ git checkout -b update-docs main
6666
Switched to a new branch 'update-docs'
6767
```
6868

69-
And deleting the current English documentation `.rst` files in the translation repository (this step is necessary to ensure we don't keep old files that may have been removed in the English version):
69+
Then, delete the current English documentation .rst files in the translation repository (this step is necessary to ensure we don't keep old files that may have been removed in the English version):
7070

7171
```shell
7272
$ rm -r ./docs/*.rst
7373
```
7474

75-
The Flask CWG in discussion with the Flask project maintainers has decided to keep the translations synchronized with the documentation of the latest released version of Flask. To find the last version of the English documentation, locate the latest release tag:
75+
In discussion with the Flask project maintainers, the Flask CWG has decided to keep the translations synchronized with the documentation of the latest released version of Flask. To find the most recent version of the English documentation, locate the latest release tag:
7676

7777
```shell
7878
$ git tag --sort=-taggerdate | head -n 1
7979
3.0.3
8080

8181
```
8282

83-
Once you know the right tag, you can checkout the right version of the documentation folder into your new branch:
83+
Once you have the right tag, you can checkout the right version of the documentation folder into your new branch:
8484

8585
```shell
8686
$ git checkout 3.0.3 ./docs/
@@ -116,15 +116,15 @@ git commit -m 'Updated the English documentation'
116116

117117
```
118118

119-
Next, to make sure you keep up with the documentation building requirements, also update the requirements folder.
119+
Next, to ensure you keep up with the documentation building requirements, update the requirements folder as well.
120120

121121
```shell
122122
git checkout 3.0.3 ./requirements/
123123
Updated 0 paths from a7d387fa
124124

125125
```
126126

127-
In this case no files were updated ("Updated 0 paths"), but if the requirements change, we will need those changes as well.
127+
In this case, no files were updated ("Updated 0 paths"). But, if the requirements change, we will need those changes as well.
128128

129129
## Prepare a virtual environment to build the documentation
130130

@@ -149,7 +149,7 @@ Collecting charset-normalizer==3.3.2
149149

150150
## Recreate the translation templates (`.pot` files)
151151

152-
Before you can update the translation files for the language you are working on, you need to recreate the translation template files with the latest version of the documentation you just copied. This is an intermediate step and you will not be working on these files directly, they are stored in the `./_build/gettext` folder.
152+
Before you can update the translation files for the language you are working on, you need to recreate the translation template files with the latest version of the documentation you just copied. This is an intermediate step as you will not be working on these files directly. They are stored in the `./_build/gettext` folder.
153153

154154
```shell
155155
$ cd ./docs
@@ -167,7 +167,7 @@ loading intersphinx inventory from https://docs.sqlalchemy.org/objects.inv...
167167

168168
## Update the translation files (`.po` files)
169169

170-
Before we can run the next step, we need to install `sphinx-intl` in the current virtual environment. Since this is a requirement for the translation work, it is not part of the original documentation requirements:
170+
Before we can run the next step, you need to install sphinx-intl in your current virtual environment. Since this is a requirement for the translation work, it is not part of the original documentation requirements:
171171

172172
```shell
173173
$ pip install sphinx-intl
@@ -179,10 +179,11 @@ Requirement already satisfied: sphinx in /home/felipe/github/flaskcwg/flask-docs
179179
(...)
180180
```
181181

182-
Now you are ready to update the translations for the language you are working one. In the example below, we are working with the Spanish translation (language code `es`), remember to replace the language code for the one for your language:
182+
You are now ready to update the translation for the language you are working on. In the example below, we are working with the Spanish translation (language code `es`). Remember to replace the language code for the one for your language:
183183

184184
```shell
185-
$ sphinx-intl update -p _build/gettext -l esUpdate: locales/es/LC_MESSAGES/api.po +19, -26
185+
$ sphinx-intl update -p _build/gettext -l es
186+
Update: locales/es/LC_MESSAGES/api.po +19, -26
186187
Not Changed: locales/es/LC_MESSAGES/config.po
187188
Not Changed: locales/es/LC_MESSAGES/templating.po
188189
Not Changed: locales/es/LC_MESSAGES/license.po
@@ -196,13 +197,13 @@ At this point, the `.po` files in the `./locales` folder have been updated with
196197

197198
The update process will preserve the current translations and add new strings that might have been added to the English documentation.
198199

199-
If some of the already translated strings changed in the English documentation, the corresponding entries in the `.po` files will be marked with the tag "fuzzy", indicating they need to be checked for accuracy.
200+
If some of the already translated strings changed in the English documentation, the corresponding entries in the .po files will be marked with the tag "fuzzy", indicating they need to be checked for accuracy.
200201

201202
For more information about the PO format, including the fuzzy tag, consult the [gettext documentation](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html).
202203

203204
## Commit the translation files
204205

205-
Add the updated translation files to the branch. You do not need to worry about the `.pot` files, they don't need to be stored in the repository.
206+
Add the updated translation files to the branch. You do not need to worry about the .pot files, they don't need to be stored in the repository.
206207

207208
```shell
208209
$ git add ./locales/
@@ -224,4 +225,4 @@ $ git commit -m 'Updated the translation files'
224225

225226
## Make a PR
226227

227-
Add this point you are ready to create a pull request to incorporate your changes into the Flask CWG language repository. You can find more information about creating a pull request in the [GitHub documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
228+
At this point, you are ready to create a pull request to incorporate your changes into the Flask CWG language repository. You can find more information about creating a pull request in the [GitHub documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

0 commit comments

Comments
 (0)