Skip to content

Commit

Permalink
Merge branch 'jx/i18n'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gitster committed Apr 21, 2014
2 parents 0b17b43 + cbcfd4e commit 8fe3ee6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
10 changes: 10 additions & 0 deletions Documentation/CodingGuidelines
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ For C programs:
* multi-line comment.
*/

Note however that a comment that explains a translatable string to
translators uses a convention of starting with a magic token
"TRANSLATORS: " immediately after the opening delimiter, even when
it spans multiple lines. We do not add an asterisk at the beginning
of each line, either. E.g.

/* TRANSLATORS: here is a comment that explains the string
to be translated, that follows immediately after it */
_("Here is a translatable string explained by the above.");

- Double negation is often harder to understand than no negation
at all.

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,7 @@ pdf:

XGETTEXT_FLAGS = \
--force-po \
--add-comments \
--add-comments=TRANSLATORS: \
--msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
--from-code=UTF-8
XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
Expand Down
8 changes: 3 additions & 5 deletions builtin/init-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,9 @@ int init_db(const char *template_dir, unsigned int flags)
if (!(flags & INIT_DB_QUIET)) {
int len = strlen(git_dir);

/*
* TRANSLATORS: The first '%s' is either "Reinitialized
* existing" or "Initialized empty", the second " shared" or
* "", and the last '%s%s' is the verbatim directory name.
*/
/* TRANSLATORS: The first '%s' is either "Reinitialized
existing" or "Initialized empty", the second " shared" or
"", and the last '%s%s' is the verbatim directory name. */
printf(_("%s%s Git repository in %s%s\n"),
reinit ? _("Reinitialized existing") : _("Initialized empty"),
shared_repository ? _(" shared") : "",
Expand Down
2 changes: 1 addition & 1 deletion date.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ void show_date_relative(unsigned long time, int tz,
if (months) {
struct strbuf sb = STRBUF_INIT;
strbuf_addf(&sb, Q_("%lu year", "%lu years", years), years);
/* TRANSLATORS: "%s" is "<n> years" */
strbuf_addf(timebuf,
/* TRANSLATORS: "%s" is "<n> years" */
Q_("%s, %lu month ago", "%s, %lu months ago", months),
sb.buf, months);
strbuf_release(&sb);
Expand Down
8 changes: 0 additions & 8 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1461,20 +1461,12 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
* but nothing about added/removed lines? Is this a bug in Git?").
*/
if (insertions || deletions == 0) {
/*
* TRANSLATORS: "+" in (+) is a line addition marker;
* do not translate it.
*/
strbuf_addf(&sb,
(insertions == 1) ? ", %d insertion(+)" : ", %d insertions(+)",
insertions);
}

if (deletions || insertions == 0) {
/*
* TRANSLATORS: "-" in (-) is a line removal marker;
* do not translate it.
*/
strbuf_addf(&sb,
(deletions == 1) ? ", %d deletion(-)" : ", %d deletions(-)",
deletions);
Expand Down

0 comments on commit 8fe3ee6

Please sign in to comment.