Merge branch 'jx/i18n'
authorJunio C Hamano <gitster@pobox.com>
Mon, 21 Apr 2014 17:42:52 +0000 (10:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Apr 2014 17:42:52 +0000 (10:42 -0700)
* 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

Documentation/CodingGuidelines
Makefile
builtin/init-db.c
date.c
diff.c
index dab5c61bfe4649e603e986d008c66b410038050b..f424dbd75c80abb4d6fecce18f6fc25859bdcb00 100644 (file)
@@ -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.
 
index 2128ce3ea21a4801b9e85e0314a36d4c4dc39b4b..a53f3a8326c2e62dc79bae7169d64137ac3dab20 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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 \
index c7c76bbf21fd5b5c9200b2535875b912e4d49000..56f85e239ae0d2607c38e3c46013007ba9e71b12 100644 (file)
@@ -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") : "",
diff --git a/date.c b/date.c
index e1a2cee5688a64555d7820e8e02e3e86839c9641..782de95d90c6ac1a02ddfa0df81ca93ecdf910c4 100644 (file)
--- a/date.c
+++ b/date.c
@@ -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);
diff --git a/diff.c b/diff.c
index 539997fc6a679b2d85479a4d8f12f864d92b6c7c..54d530826881684c916a78a4334579a2e401ee47 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -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);