@@ -9,8 +9,14 @@ coordinates our localization effort in the l10 coordinator repository:
9
9
10
10
https://github.com/git-l10n/git-po/
11
11
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.
14
20
15
21
16
22
## Contributing to an existing translation
@@ -39,72 +45,74 @@ language, so that the l10n coordinator only needs to interact with one
39
45
person per language.
40
46
41
47
42
- ## Core translation
48
+ ## Translation Process Flow
43
49
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:
48
51
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
+ +----------------------------------+
52
62
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:
56
66
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"
59
70
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)
65
75
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"
68
80
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).
69
84
70
- ## Translation Process Flow
71
85
72
- The overall data-flow looks like this:
86
+ ## Dynamically generated POT files
73
87
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.
84
92
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.
92
95
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:
93
99
94
- ## Maintaining the "po/git.pot" file
100
+ ``` shell
101
+ make po/git.pot
102
+ ```
95
103
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.
97
109
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:
105
112
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
+ ```
108
116
109
117
110
118
## Initializing a "XX.po" file
@@ -115,32 +123,14 @@ If your language XX does not have translated message file "po/XX.po" yet,
115
123
you add a translation for the first time by running:
116
124
117
125
``` shell
118
- msginit --locale=XX
126
+ make po-init PO_FILE=po/XX.po
119
127
```
120
128
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.
140
130
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.
144
134
145
135
Once you are done testing the translation (see below), commit the result
146
136
and ask the l10n coordinator to pull from you.
@@ -153,19 +143,53 @@ and ask the l10n coordinator to pull from you.
153
143
If you are replacing translation strings in an existing "XX.po" file to
154
144
improve the translation, just edit the file.
155
145
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:
160
148
161
149
``` shell
162
- msgmerge --add-location --backup=off -U XX.po git.pot
150
+ make po-update PO_FILE=po/ XX.po
163
151
```
164
152
165
- in the "po/" directory, where "XX.po" is the file you want to update.
153
+ It will:
166
154
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.
169
193
170
194
171
195
## Fuzzy translation
@@ -196,6 +220,14 @@ common errors, e.g. missing printf format strings, or translated
196
220
messages that deviate from the originals in whether they begin/end
197
221
with a newline or not.
198
222
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
+
199
231
200
232
## Marking strings for translation
201
233
@@ -370,29 +402,6 @@ l10n workflow.
370
402
To build and install the helper program from source, see
371
403
[ git-po-helper/README] [ ] .
372
404
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
-
396
405
397
406
## Conventions
398
407
@@ -436,13 +445,8 @@ additional conventions:
436
445
- Initialize proper filename of the "XX.po" file conforming to
437
446
iso-639 and iso-3166.
438
447
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.
446
450
447
451
- Add a new entry in the "po/TEAMS" file with proper format, and check
448
452
the syntax of "po/TEAMS" by running the following command:
0 commit comments