Skip to content

Commit e2f4045

Browse files
avargitster
authored andcommitted
l10n: Document the new l10n workflow
Change the "flow" of how translators interact with the l10n repository at [1] to adjust it for a new workflow of not having a po/git.pot file in-tree at all, and to not commit line numbers to the po/*.po files that we do track in tree. The current workflow was added in a combination of dce37b6 (l10n: initial git.pot for 1.7.10 upcoming release, 2012-02-13) and 271ce19 (Update l10n guide, 2012-02-29). As noted in preceding commits I think that it came about due to technical debt I'd left behind in how the "po/git.pot" file was created, and a mis-impression that the file:line comments were needed as anything more than a transitory translation aid. As the updated po/README.md shows the new workflow is substantially the same, the difference is that translators no longer need to initially pull from the l10n coordinator for a new po/git.pot, they can simply use git.git's canonical source repository. The l10n coordinator is still expected to announce a release to translate, which presumably would always be Junio's latest release tag. I'm not certain if this part of the process is actually important. I.e. the delta translation-wise between that tag and "master" is usually pretty small, so perhaps translators can just work on "master" instead. 1. https://github.com/git-l10n/git-po/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Jiang Xin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b9832f7 commit e2f4045

File tree

1 file changed

+117
-113
lines changed

1 file changed

+117
-113
lines changed

po/README.md

Lines changed: 117 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ coordinates our localization effort in the l10 coordinator repository:
99

1010
https://github.com/git-l10n/git-po/
1111

12-
The two character language translation codes are defined by ISO\_639-1, as
13-
stated in the gettext(1) full manual, appendix A.1, Usual Language Codes.
12+
We will use XX as an alias to refer to the language translation code in
13+
the following paragraphs, for example we use "po/XX.po" to refer to the
14+
translation file for a specific language. But this doesn't mean that
15+
the language code has only two letters. The language code can be in one
16+
of two forms: "ll" or "ll\_CC". Here "ll" is the ISO 639 two-letter
17+
language code and "CC" is the ISO 3166 two-letter code for country names
18+
and subdivisions. For example: "de" for German language code, "zh\_CN"
19+
for Simplified Chinese language code.
1420

1521

1622
## Contributing to an existing translation
@@ -39,72 +45,74 @@ language, so that the l10n coordinator only needs to interact with one
3945
person per language.
4046

4147

42-
## Core translation
48+
## Translation Process Flow
4349

44-
The core translation is the smallest set of work that must be completed
45-
for a new language translation. Because there are more than 5000 messages
46-
in the template message file "po/git.pot" that need to be translated,
47-
this is not a piece of cake for the contributor for a new language.
50+
The overall data-flow looks like this:
4851

49-
The core template message file which contains a small set of messages
50-
will be generated in "po-core/core.pot" automatically by running a helper
51-
program named "git-po-helper" (described later).
52+
+-------------------+ +------------------+
53+
| Git source code | ----(2)---> | L10n coordinator |
54+
| repository | <---(5)---- | repository |
55+
+-------------------+ +------------------+
56+
| | ^
57+
(1) (3) (4)
58+
V v |
59+
+----------------------------------+
60+
| Language Team XX |
61+
+----------------------------------+
5262

53-
```shell
54-
git-po-helper init --core XX.po
55-
```
63+
- Translatable strings are marked in the source file.
64+
- Language teams can start translation iterations at any time, even
65+
before the l10n window opens:
5666

57-
After translating the generated "po-core/XX.po", you can merge it to
58-
"po/XX.po" using the following commands:
67+
+ Pull from the master branch of the source (1)
68+
+ Update the message file by running "make po-update PO\_FILE=po/XX.po"
69+
+ Translate the message file "po/XX.po"
5970

60-
```shell
61-
msgcat po-core/XX.po po/XX.po -s -o /tmp/XX.po
62-
mv /tmp/XX.po po/XX.po
63-
git-po-helper update XX.po
64-
```
71+
- The L10n coordinator pulls from source and announces the l10n window
72+
open (2)
73+
- Language team pulls from the l10n coordinator, starts another
74+
translation iteration against the l10n coordinator's tree (3)
6575

66-
Edit "po/XX.po" by hand to fix "fuzzy" messages, which may have misplaced
67-
translated messages and duplicate messages.
76+
+ Run "git pull --rebase" from the l10n coordinator
77+
+ Update the message file by running "make po-update PO\_FILE=po/XX.po"
78+
+ Translate the message file "po/XX.po"
79+
+ Squash trivial l10n git commits using "git rebase -i"
6880

81+
- Language team sends pull request to the l10n coordinator (4)
82+
- L10n coordinator checks and merges
83+
- L10n coordinator asks the result to be pulled (5).
6984

70-
## Translation Process Flow
7185

72-
The overall data-flow looks like this:
86+
## Dynamically generated POT files
7387

74-
+-------------------+ +------------------+
75-
| Git source code | ---(1)---> | L10n coordinator |
76-
| repository | <---(4)--- | repository |
77-
+-------------------+ +------------------+
78-
| ^
79-
(2) (3)
80-
V |
81-
+------------------+
82-
| Language Team XX |
83-
+------------------+
88+
POT files are templates for l10n contributors to create or update their
89+
translation files. We used to have the "po/git.pot" file which was
90+
generated by the l10n coordinator, but this file had been removed from
91+
the tree.
8492

85-
- Translatable strings are marked in the source file.
86-
- L10n coordinator pulls from the source (1)
87-
- L10n coordinator updates the message template "po/git.pot"
88-
- Language team pulls from L10n coordinator (2)
89-
- Language team updates the message file "po/XX.po"
90-
- L10n coordinator pulls from Language team (3)
91-
- L10n coordinator asks the result to be pulled (4).
93+
The two POT files "po/git.pot" and "po/git-core.pot" can be created
94+
dynamically when necessary.
9295

96+
L10n contributors use "po/git.pot" to prepare translations for their
97+
languages, but they are not expected to modify it. The "po/git.pot" file
98+
can be generated manually with the following command:
9399

94-
## Maintaining the "po/git.pot" file
100+
```shell
101+
make po/git.pot
102+
```
95103

96-
(This is done by the l10n coordinator).
104+
The "po/git-core.pot" file is the template for core translations. A core
105+
translation is the minimum set of work necessary to complete a
106+
translation of a new language. Since there are more than 5000 messages
107+
in the full set of template message file "po/git.pot" that need to be
108+
translated, this is not a piece of cake for new language contributors.
97109

98-
The "po/git.pot" file contains a message catalog extracted from Git's
99-
sources. The l10n coordinator maintains it by adding new translations with
100-
msginit(1), or update existing ones with msgmerge(1). In order to update
101-
the Git sources to extract the messages from, the l10n coordinator is
102-
expected to pull from the main git repository at strategic point in
103-
history (e.g. when a major release and release candidates are tagged),
104-
and then run "make pot" at the top-level directory.
110+
The "core" template file "po/git-core.pot" can be generated manually
111+
by running:
105112

106-
Language contributors use this file to prepare translations for their
107-
language, but they are not expected to modify it.
113+
```shell
114+
make po/git-core.pot
115+
```
108116

109117

110118
## Initializing a "XX.po" file
@@ -115,32 +123,14 @@ If your language XX does not have translated message file "po/XX.po" yet,
115123
you add a translation for the first time by running:
116124

117125
```shell
118-
msginit --locale=XX
126+
make po-init PO_FILE=po/XX.po
119127
```
120128

121-
in the "po/" directory, where XX is the locale, e.g. "de", "is", "pt\_BR",
122-
"zh\_CN", etc.
123-
124-
Then edit the automatically generated copyright info in your new "XX.po"
125-
to be correct, e.g. for Icelandic:
126-
127-
```diff
128-
@@ -1,6 +1,6 @@
129-
-# Icelandic translations for PACKAGE package.
130-
-# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
131-
-# This file is distributed under the same license as the PACKAGE package.
132-
+# Icelandic translations for Git.
133-
+# Copyright (C) 2010 Ævar Arnfjörð Bjarmason <[email protected]>
134-
+# This file is distributed under the same license as the Git package.
135-
# Ævar Arnfjörð Bjarmason <[email protected]>, 2010.
136-
```
137-
138-
And change references to PACKAGE VERSION in the PO Header Entry to
139-
just "Git":
129+
where XX is the locale, e.g. "de", "is", "pt\_BR", "zh\_CN", etc.
140130

141-
```shell
142-
perl -pi -e 's/(?<="Project-Id-Version: )PACKAGE VERSION/Git/' XX.po
143-
```
131+
The newly generated message file "po/XX.po" is based on the core pot
132+
file "po/git-core.pot", so it contains only a minimal set of messages
133+
and it's a good start for a new language contribution.
144134

145135
Once you are done testing the translation (see below), commit the result
146136
and ask the l10n coordinator to pull from you.
@@ -153,19 +143,53 @@ and ask the l10n coordinator to pull from you.
153143
If you are replacing translation strings in an existing "XX.po" file to
154144
improve the translation, just edit the file.
155145

156-
If there's an existing "XX.po" file for your language, but the repository
157-
of the l10n coordinator has newer "po/git.pot" file, you would need to first
158-
pull from the l10n coordinator (see the beginning of this document for its
159-
URL), and then update the existing translation by running:
146+
If you want to find new translatable strings in source files of upstream
147+
repository and propagate them to your "po/XX.po", run command:
160148

161149
```shell
162-
msgmerge --add-location --backup=off -U XX.po git.pot
150+
make po-update PO_FILE=po/XX.po
163151
```
164152

165-
in the "po/" directory, where "XX.po" is the file you want to update.
153+
It will:
166154

167-
Once you are done testing the translation (see below), commit the result
168-
and ask the l10n coordinator to pull from you.
155+
- Call "make po/git.pot" to generate new "po/git.pot" file
156+
- Call "msgmerge --add-location --backup=off -U po/XX.po po/git.pot"
157+
to update your "po/XX.po"
158+
- The "--add-location" option for msgmerge will add location lines,
159+
and these location lines will help translation tools to locate
160+
translation context easily.
161+
162+
Once you are done testing the translation (see below), it's better
163+
to commit a location-less "po/XX.po" file to save repository space
164+
and make a user-friendly patch for review.
165+
166+
To save a location-less "po/XX.po" automatically in repository, you
167+
can:
168+
169+
First define a new attribute for "po/XX.po" by appending the following
170+
line in ".git/info/attributes":
171+
172+
```
173+
/po/XX.po filter=gettext-no-location
174+
```
175+
176+
Then define the driver for the "gettext-no-location" clean filter to
177+
strip out both filenames and locations from the contents as follows:
178+
179+
```shell
180+
git config --global filter.gettext-no-location.clean \
181+
"msgcat --no-location -"
182+
```
183+
184+
For users who have gettext version 0.20 or higher, it is also possible
185+
to define a clean filter to preserve filenames but not locations:
186+
187+
```shell
188+
git config --global filter.gettext-no-location.clean \
189+
"msgcat --add-location=file -"
190+
```
191+
192+
You're now ready to ask the l10n coordinator to pull from you.
169193

170194

171195
## Fuzzy translation
@@ -196,6 +220,14 @@ common errors, e.g. missing printf format strings, or translated
196220
messages that deviate from the originals in whether they begin/end
197221
with a newline or not.
198222

223+
L10n coordinator will check your contributions using a helper program
224+
(see "PO helper" section below):
225+
226+
```shell
227+
git-po-helper check-po po/XX.po
228+
git-po-helper check-commits <rev-list-opts>
229+
```
230+
199231

200232
## Marking strings for translation
201233

@@ -370,29 +402,6 @@ l10n workflow.
370402
To build and install the helper program from source, see
371403
[git-po-helper/README][].
372404

373-
Usage for git-po-helper:
374-
375-
- To start a new language translation:
376-
377-
```shell
378-
git-po-helper init XX.po
379-
```
380-
381-
- To update your "XX.po" file:
382-
383-
```shell
384-
git-po-helper update XX.po
385-
```
386-
387-
- To check commit log and syntax of "XX.po":
388-
389-
```shell
390-
git-po-helper check-po XX.po
391-
git-po-helper check-commits
392-
```
393-
394-
Run "git-po-helper" without arguments to show usage.
395-
396405

397406
## Conventions
398407

@@ -436,13 +445,8 @@ additional conventions:
436445
- Initialize proper filename of the "XX.po" file conforming to
437446
iso-639 and iso-3166.
438447

439-
- Must complete a minimal translation based on the "po-core/core.pot"
440-
template. Using the following command to initialize the minimal
441-
"po-core/XX.po" file:
442-
443-
```shell
444-
git-po-helper init --core <your-language>
445-
```
448+
- Must complete a minimal translation based on the "Core
449+
translation". See that section above.
446450

447451
- Add a new entry in the "po/TEAMS" file with proper format, and check
448452
the syntax of "po/TEAMS" by running the following command:

0 commit comments

Comments
 (0)