i18n: only extract comments marked with "TRANSLATORS:"
authorJiang Xin <worldhello.net@gmail.com>
Thu, 17 Apr 2014 05:37:18 +0000 (13:37 +0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Apr 2014 18:09:56 +0000 (11:09 -0700)
When extract l10n messages, we use "--add-comments" option to keep
comments right above the l10n messages for references. But sometimes
irrelevant comments are also extracted. For example in the following
code block, the comment in line 2 will be extracted as comment for the
l10n message in line 3, but obviously it's wrong.

{ OPTION_CALLBACK, 0, "ignore-removal", &addremove_explicit,
NULL /* takes no arguments */,
N_("ignore paths removed in the working tree (same as
--no-all)"),
PARSE_OPT_NOARG, ignore_removal_cb },

Since almost all comments for l10n translators are marked with the same
prefix (tag): "TRANSLATORS:", it's safe to only extract comments with
this special tag. I.E. it's better to call xgettext as:

xgettext --add-comments=TRANSLATORS: ...

Also tweaks the multi-line comment in "init-db.c", to make it start with
the proper tag, not "* TRANSLATORS:" (which has a star before the tag).

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
builtin/init-db.c
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") : "",