Skip to content

Commit 8fe3ee6

Browse files
committed
Merge branch 'jx/i18n'
* jx/i18n: i18n: mention "TRANSLATORS:" marker in Documentation/CodingGuidelines i18n: only extract comments marked with "TRANSLATORS:" i18n: remove obsolete comments for translators in diffstat generation i18n: fix uncatchable comments for translators in date.c
2 parents 0b17b43 + cbcfd4e commit 8fe3ee6

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

Documentation/CodingGuidelines

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ For C programs:
164164
* multi-line comment.
165165
*/
166166

167+
Note however that a comment that explains a translatable string to
168+
translators uses a convention of starting with a magic token
169+
"TRANSLATORS: " immediately after the opening delimiter, even when
170+
it spans multiple lines. We do not add an asterisk at the beginning
171+
of each line, either. E.g.
172+
173+
/* TRANSLATORS: here is a comment that explains the string
174+
to be translated, that follows immediately after it */
175+
_("Here is a translatable string explained by the above.");
176+
167177
- Double negation is often harder to understand than no negation
168178
at all.
169179

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2102,7 +2102,7 @@ pdf:
21022102

21032103
XGETTEXT_FLAGS = \
21042104
--force-po \
2105-
--add-comments \
2105+
--add-comments=TRANSLATORS: \
21062106
--msgid-bugs-address="Git Mailing List <[email protected]>" \
21072107
--from-code=UTF-8
21082108
XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \

builtin/init-db.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,9 @@ int init_db(const char *template_dir, unsigned int flags)
412412
if (!(flags & INIT_DB_QUIET)) {
413413
int len = strlen(git_dir);
414414

415-
/*
416-
* TRANSLATORS: The first '%s' is either "Reinitialized
417-
* existing" or "Initialized empty", the second " shared" or
418-
* "", and the last '%s%s' is the verbatim directory name.
419-
*/
415+
/* TRANSLATORS: The first '%s' is either "Reinitialized
416+
existing" or "Initialized empty", the second " shared" or
417+
"", and the last '%s%s' is the verbatim directory name. */
420418
printf(_("%s%s Git repository in %s%s\n"),
421419
reinit ? _("Reinitialized existing") : _("Initialized empty"),
422420
shared_repository ? _(" shared") : "",

date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ void show_date_relative(unsigned long time, int tz,
144144
if (months) {
145145
struct strbuf sb = STRBUF_INIT;
146146
strbuf_addf(&sb, Q_("%lu year", "%lu years", years), years);
147-
/* TRANSLATORS: "%s" is "<n> years" */
148147
strbuf_addf(timebuf,
148+
/* TRANSLATORS: "%s" is "<n> years" */
149149
Q_("%s, %lu month ago", "%s, %lu months ago", months),
150150
sb.buf, months);
151151
strbuf_release(&sb);

diff.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,20 +1461,12 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
14611461
* but nothing about added/removed lines? Is this a bug in Git?").
14621462
*/
14631463
if (insertions || deletions == 0) {
1464-
/*
1465-
* TRANSLATORS: "+" in (+) is a line addition marker;
1466-
* do not translate it.
1467-
*/
14681464
strbuf_addf(&sb,
14691465
(insertions == 1) ? ", %d insertion(+)" : ", %d insertions(+)",
14701466
insertions);
14711467
}
14721468

14731469
if (deletions || insertions == 0) {
1474-
/*
1475-
* TRANSLATORS: "-" in (-) is a line removal marker;
1476-
* do not translate it.
1477-
*/
14781470
strbuf_addf(&sb,
14791471
(deletions == 1) ? ", %d deletion(-)" : ", %d deletions(-)",
14801472
deletions);

0 commit comments

Comments
 (0)