{"thread":{"id":"36428","subject":"[l10n] date: Note for translators not included in .po files","startedAt":"2014-04-16T22:51:57Z","lastAt":"2014-04-18T17:48:08Z","messageCount":13,"participants":["Brian Gesiak","Jiang Xin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"238989","messageId":"CAN7MxmV5tzvGTTG+aOL73fLhbXc7YeOWvYwLkMyad0=mvffMHQ@mail.gmail.com","threadId":"36428","inReplyTo":null,"subject":"[l10n] date: Note for translators not included in .po files","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-04-16T22:51:57Z","receivedAt":"2014-04-16T22:51:57Z","isPatch":false,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"A note for translators in date.c is not included in git.pot.\nNamely, the following note from date.c:147 is not included\n(https://github.com/git/git/blob/v1.9.2/date.c#L147):\n\n/* TRANSLATORS: \"%s\" is \"<n> years\" */\n\nThis is a very useful note for translators (in fact, I think\nthe zh_CN translation for date.c:149 might be a little off\nbecause this note was not included. My Mandarin is rusty,\nbut I believe \"<n> years, <m> months ago\" should be expressed\nwithout a comma).\n\nAccording to po/README, the l10n coordinator is responsible\nfor updating the git.pot file. Would it be possible to update it based\non v1.9.2 and include the above comment?\n\nBy the way, I am trying to organize contributors to produce a Japanese\nlocalization for Core Git. Currently we have plenty of interest but\nonly two contributors. If you or anyone you know would like to contribute\nplease visit the repository here: https://github.com/modocache/git-po-ja\n\nThanks!\n\n- Brian Gesiak\n"},{"id":"238997","messageId":"CANYiYbGC0MsYFMv2kUjDxE64tO_gXb6gtFoRMNv4zpyTcHdT+w@mail.gmail.com","threadId":"36428","inReplyTo":"CAN7MxmV5tzvGTTG+aOL73fLhbXc7YeOWvYwLkMyad0=mvffMHQ@mail.gmail.com","subject":"Re: [l10n] date: Note for translators not included in .po files","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2014-04-17T01:41:42Z","receivedAt":"2014-04-17T01:41:42Z","isPatch":false,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2014-04-17 6:51 GMT+08:00 Brian Gesiak <modocache@gmail.com>:\n> A note for translators in date.c is not included in git.pot.\n> Namely, the following note from date.c:147 is not included\n> (https://github.com/git/git/blob/v1.9.2/date.c#L147):\n>\n> /* TRANSLATORS: \"%s\" is \"<n> years\" */\n>\n\nComments for translators will be extracted to pot file automatically,\nwhen run xgettext with \"--add-comments\" option.\n\n       -c, --add-comments\n              place all comment blocks preceding keyword lines in output file\n\nFor example, the comments in the following code blocks will\nbe extracted.\n\n       /* TRANSLATORS: \"will be extracted.\" */\n       strbuf_addf(&sb, Q_(\"%lu year\", \"%lu years\", years), years);\n\n        strbuf_addf(&sb,\n               /* TRANSLATORS: \"will be extracted.\" */\n               Q_(\"%lu year\", \"%lu years\", years), years);\n\nBut if the comment is not right before the l10n markers, such\ncomments will not be extracted. E.g.\n\n        /* TRANSLATORS: \"WARNING: will NOT be extracted.\" */\n        strbuf_addf(&sb,\n                Q_(\"%lu year\", \"%lu years\", years), years);\n\n        /* TRANSLATORS: \"WARNING: will NOT be extracted.\" */\n        strbuf_addf(&sb, Q_(\n                \"%lu year\", \"%lu years\", years), years);\n\n\nI will scan all the codes and make a fix.\n\n> This is a very useful note for translators (in fact, I think\n> the zh_CN translation for date.c:149 might be a little off\n> because this note was not included. My Mandarin is rusty,\n> but I believe \"<n> years, <m> months ago\" should be expressed\n> without a comma).\n>\n> According to po/README, the l10n coordinator is responsible\n> for updating the git.pot file. Would it be possible to update it based\n> on v1.9.2 and include the above comment?\n>\n\nI could generate a new git.pot for \"maint\" branch, but fixes for codes\nmay only contribute to \"master\" branch.\n\n\n-- \nJiang Xin\n"},{"id":"239000","messageId":"cover.1397712142.git.worldhello.net@gmail.com","threadId":"36428","inReplyTo":"CAN7MxmV5tzvGTTG+aOL73fLhbXc7YeOWvYwLkMyad0=mvffMHQ@mail.gmail.com","subject":"[PATCH 0/3] extract proper comments for l10n translators","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2014-04-17T05:37:16Z","receivedAt":"2014-04-17T05:37:16Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"When generate git.pot, many irrelevant comments are extracted as references\nfor translators, but one useful comment is lost.  This series patches will\nfix this issue.\n\nJiang Xin (3):\n  i18n: Fixes uncatchable comments for translators\n  i18n: Only extract comments marked by special tag\n  i18n: Remove obsolete comments for translators\n\n Makefile          | 2 +-\n builtin/init-db.c | 8 +++-----\n date.c            | 2 +-\n diff.c            | 8 --------\n 4 files changed, 5 insertions(+), 15 deletions(-)\n\n-- \n1.9.2.461.g942803f\n"},{"id":"239001","messageId":"3f527f9939d093c7e063337f47fea41a740899c3.1397712142.git.worldhello.net@gmail.com","threadId":"36428","inReplyTo":"cover.1397712142.git.worldhello.net@gmail.com","subject":"[PATCH 1/3] i18n: Fixes uncatchable comments for translators","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2014-04-17T05:37:17Z","receivedAt":"2014-04-17T05:37:17Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Comment for l10n translators can not be extracted by xgettext if it is\nnot right above the l10n tag.  Moving the comment right before the l10n\ntag will fix this issue.\n\nReported-by: Brian Gesiak <modocache@gmail.com>\nSigned-off-by: Jiang Xin <worldhello.net@gmail.com>\n---\n date.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/date.c b/date.c\nindex e1a2cee..782de95 100644\n--- a/date.c\n+++ b/date.c\n@@ -144,8 +144,8 @@ void show_date_relative(unsigned long time, int tz,\n \t\tif (months) {\n \t\t\tstruct strbuf sb = STRBUF_INIT;\n \t\t\tstrbuf_addf(&sb, Q_(\"%lu year\", \"%lu years\", years), years);\n-\t\t\t/* TRANSLATORS: \"%s\" is \"<n> years\" */\n \t\t\tstrbuf_addf(timebuf,\n+\t\t\t\t /* TRANSLATORS: \"%s\" is \"<n> years\" */\n \t\t\t\t Q_(\"%s, %lu month ago\", \"%s, %lu months ago\", months),\n \t\t\t\t sb.buf, months);\n \t\t\tstrbuf_release(&sb);\n-- \n1.9.2.461.g942803f\n"},{"id":"239002","messageId":"2ce9ec406501d112e032c8208417f8100bed04c6.1397712142.git.worldhello.net@gmail.com","threadId":"36428","inReplyTo":"cover.1397712142.git.worldhello.net@gmail.com","subject":"[PATCH 2/3] i18n: Only extract comments marked by special tag","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2014-04-17T05:37:18Z","receivedAt":"2014-04-17T05:37:18Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"When extract l10n messages, we use \"--add-comments\" option to keep\ncomments right above the l10n messages for references.  But sometimes\nirrelevant comments are also extracted.  For example in the following\ncode block, the comment in line 2 will be extracted as comment for the\nl10n message in line 3, but obviously it's wrong.\n\n        { OPTION_CALLBACK, 0, \"ignore-removal\", &addremove_explicit,\n          NULL /* takes no arguments */,\n          N_(\"ignore paths removed in the working tree (same as\n          --no-all)\"),\n          PARSE_OPT_NOARG, ignore_removal_cb },\n\nSince almost all comments for l10n translators are marked with the same\nprefix (tag): \"TRANSLATORS:\", it's safe to only extract comments with\nthis special tag.  I.E. it's better to call xgettext as:\n\n        xgettext --add-comments=TRANSLATORS: ...\n\nAlso tweaks the multi-line comment in \"init-db.c\", to make it start with\nthe proper tag, not \"* TRANSLATORS:\" (which has a star before the tag).\n\nSigned-off-by: Jiang Xin <worldhello.net@gmail.com>\n---\n Makefile          | 2 +-\n builtin/init-db.c | 8 +++-----\n 2 files changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 2128ce3..a53f3a8 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2102,7 +2102,7 @@ pdf:\n \n XGETTEXT_FLAGS = \\\n \t--force-po \\\n-\t--add-comments \\\n+\t--add-comments=TRANSLATORS: \\\n \t--msgid-bugs-address=\"Git Mailing List <git@vger.kernel.org>\" \\\n \t--from-code=UTF-8\n XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \\\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex c7c76bb..56f85e2 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -412,11 +412,9 @@ int init_db(const char *template_dir, unsigned int flags)\n \tif (!(flags & INIT_DB_QUIET)) {\n \t\tint len = strlen(git_dir);\n \n-\t\t/*\n-\t\t * TRANSLATORS: The first '%s' is either \"Reinitialized\n-\t\t * existing\" or \"Initialized empty\", the second \" shared\" or\n-\t\t * \"\", and the last '%s%s' is the verbatim directory name.\n-\t\t */\n+\t\t/* TRANSLATORS: The first '%s' is either \"Reinitialized\n+\t\t   existing\" or \"Initialized empty\", the second \" shared\" or\n+\t\t   \"\", and the last '%s%s' is the verbatim directory name. */\n \t\tprintf(_(\"%s%s Git repository in %s%s\\n\"),\n \t\t       reinit ? _(\"Reinitialized existing\") : _(\"Initialized empty\"),\n \t\t       shared_repository ? _(\" shared\") : \"\",\n-- \n1.9.2.461.g942803f\n"},{"id":"239003","messageId":"dc0974cc87aa692fdea4f145935df2c1ac3c9f49.1397712142.git.worldhello.net@gmail.com","threadId":"36428","inReplyTo":"cover.1397712142.git.worldhello.net@gmail.com","subject":"[PATCH 3/3] i18n: Remove obsolete comments for translators","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2014-04-17T05:37:19Z","receivedAt":"2014-04-17T05:37:19Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Since we do not translate diffstat any more, remove the obsolete comments.\n\nSigned-off-by: Jiang Xin <worldhello.net@gmail.com>\n---\n diff.c | 8 --------\n 1 file changed, 8 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 539997f..54d5308 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1461,20 +1461,12 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)\n \t * but nothing about added/removed lines? Is this a bug in Git?\").\n \t */\n \tif (insertions || deletions == 0) {\n-\t\t/*\n-\t\t * TRANSLATORS: \"+\" in (+) is a line addition marker;\n-\t\t * do not translate it.\n-\t\t */\n \t\tstrbuf_addf(&sb,\n \t\t\t    (insertions == 1) ? \", %d insertion(+)\" : \", %d insertions(+)\",\n \t\t\t    insertions);\n \t}\n \n \tif (deletions || insertions == 0) {\n-\t\t/*\n-\t\t * TRANSLATORS: \"-\" in (-) is a line removal marker;\n-\t\t * do not translate it.\n-\t\t */\n \t\tstrbuf_addf(&sb,\n \t\t\t    (deletions == 1) ? \", %d deletion(-)\" : \", %d deletions(-)\",\n \t\t\t    deletions);\n-- \n1.9.2.461.g942803f\n"},{"id":"239004","messageId":"CANYiYbGUKiOyoBOPHH+jvdZx1hKoUshh7O0KnpWUQEzbvd8TfQ@mail.gmail.com","threadId":"36428","inReplyTo":"cover.1397712142.git.worldhello.net@gmail.com","subject":"Re: [PATCH 0/3] extract proper comments for l10n translators","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2014-04-17T05:50:56Z","receivedAt":"2014-04-17T05:50:56Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2014-04-17 13:37 GMT+08:00 Jiang Xin <worldhello.net@gmail.com>:\n> When generate git.pot, many irrelevant comments are extracted as references\n> for translators, but one useful comment is lost.  This series patches will\n> fix this issue.\n\nBrief changes of po/git.pot after applied these patches:\n\ndiff --git a/po/git.pot b/po/git.pot\nindex f70b46b..9e474f3 100644\n--- a/po/git.pot\n+++ b/po/git.pot\n@@ -23,10 +23,6 @@ msgstr \"\"\n msgid \"hint: %.*s\\n\"\n msgstr \"\"\n\n-#.\n-#. * Message used both when 'git commit' fails and when\n-#. * other commands doing a merge do.\n-#.\n #: advice.c:85\n msgid \"\"\n \"Fix them up in the work tree,\\n\"\n@@ -399,6 +395,7 @@ msgid_plural \"%lu years\"\n msgstr[0] \"\"\n msgstr[1] \"\"\n\n+#. TRANSLATORS: \"%s\" is \"<n> years\"\n #: date.c:149\n #, c-format\n msgid \"%s, %lu month ago\"\n@@ -582,8 +579,6 @@ msgstr \"\"\n msgid \"Removing %s to make room for subdirectory\\n\"\n msgstr \"\"\n\n-#. something else exists\n-#. .. but not some other error (who really cares what?)\n #: merge-recursive.c:700 merge-recursive.c:721\n msgid \": perhaps a D/F conflict?\"\n msgstr \"\"\n@@ -899,11 +894,6 @@ msgstr \"\"\n msgid \"Pathspec '%s' is in submodule '%.*s'\"\n msgstr \"\"\n\n-#.\n-#. * We may want to substitute \"this command\" with a command\n-#. * name. E.g. when add--interactive dies when running\n-#. * \"checkout -p\"\n-#.\n #: pathspec.c:353\n #, c-format\n msgid \"%s: pathspec magic not supported by this command: %s\"\n@@ -953,11 +943,6 @@ msgstr \"\"\n msgid \"%s tracks both %s and %s\"\n msgstr \"\"\n\n-#.\n-#. * This last possibility doesn't occur because\n-#. * FETCH_HEAD_IGNORE entries always appear at\n-#. * the end of the list.\n-#.\n #: remote.c:774\n msgid \"Internal error\"\n msgstr \"\"\n@@ -1306,13 +1291,11 @@ msgstr \"\"\n msgid \"Could not find section in .gitmodules where path=%s\"\n msgstr \"\"\n\n-#. Maybe the user already did that, don't error out here\n #: submodule.c:76\n #, c-format\n msgid \"Could not update .gitmodules entry %s\"\n msgstr \"\"\n\n-#. Maybe the user already did that, don't error out here\n #: submodule.c:109\n #, c-format\n msgid \"Could not remove .gitmodules entry for %s\"\n@@ -1884,7 +1867,6 @@ msgstr \"\"\n msgid \"add changes from all tracked and untracked files\"\n msgstr \"\"\n\n-#. takes no arguments\n #: builtin/add.c:260\n msgid \"ignore paths removed in the working tree (same as --no-all)\"\n msgstr \"\"\n@@ -2044,7 +2026,6 @@ msgstr \"\"\n msgid \"corrupt binary patch at line %d: %.*s\"\n msgstr \"\"\n\n-#. there has to be one hunk (forward hunk)\n #: builtin/apply.c:1900\n #, c-format\n msgid \"unrecognized binary patch at line %d\"\n@@ -2232,7 +2213,6 @@ msgstr \"\"\n msgid \"internal error\"\n msgstr \"\"\n\n-#. Say this even without --verbose\n #: builtin/apply.c:4043\n #, c-format\n msgid \"Applying patch %%s with %d reject...\"\n@@ -3232,7 +3212,6 @@ msgstr \"\"\n msgid \" ... and %d more.\\n\"\n msgstr \"\"\n\n-#. The singular version\n #: builtin/checkout.c:711\n #, c-format\n msgid \"\"\n@@ -3280,7 +3259,6 @@ msgstr \"\"\n msgid \"invalid reference: %s\"\n msgstr \"\"\n\n-#. case (1): want a tree\n #: builtin/checkout.c:1002\n #, c-format\n msgid \"reference is not a tree: %s\"\n@@ -4276,7 +4254,6 @@ msgstr \"\"\n msgid \"GPG sign commit\"\n msgstr \"\"\n\n-#. end commit message options\n #: builtin/commit.c:1508\n msgid \"Commit contents options\"\n msgstr \"\"\n@@ -5140,7 +5117,6 @@ msgstr \"\"\n msgid \"See \\\"git help gc\\\" for manual housekeeping.\\n\"\n msgstr \"\"\n\n-#. be quiet on --auto\n #: builtin/gc.c:336\n #, c-format\n msgid \"\"\n@@ -5894,12 +5870,10 @@ msgstr \"\"\n msgid \"unable to move %s to %s\"\n msgstr \"\"\n\n-#.\n-#. * TRANSLATORS: The first '%s' is either \"Reinitialized\n-#. * existing\" or \"Initialized empty\", the second \" shared\" or\n-#. * \"\", and the last '%s%s' is the verbatim directory name.\n-#.\n-#: builtin/init-db.c:420\n+#. TRANSLATORS: The first '%s' is either \"Reinitialized\n+#. existing\" or \"Initialized empty\", the second \" shared\" or\n+#. \"\", and the last '%s%s' is the verbatim directory name.\n+#: builtin/init-db.c:418\n #, c-format\n msgid \"%s%s Git repository in %s%s\\n\"\n msgstr \"\"\n@@ -6627,7 +6601,6 @@ msgstr \"\"\n msgid \"Commit %s has a bad GPG signature allegedly by %s.\"\n msgstr \"\"\n\n-#. 'N'\n #: builtin/merge.c:1279\n #, c-format\n msgid \"Commit %s does not have a GPG signature.\"\n@@ -9593,8 +9566,6 @@ msgstr \"\"\n msgid \"'git bisect bad' can take only one argument.\"\n msgstr \"\"\n\n-#. have bad but not good.  we could bisect although\n-#. this is less optimum.\n #: git-bisect.sh:273\n msgid \"Warning: bisecting only with a bad commit.\"\n msgstr \"\"\n@@ -9690,10 +9661,6 @@ msgstr \"\"\n msgid \"updating an unborn branch with changes added to the index\"\n msgstr \"\"\n\n-#. The fetch involved updating the current branch.\n-#. The working tree and the index file is still based on the\n-#. $orig_head commit, but we are merging into $curr_head.\n-#. First update the working tree to match $curr_head.\n #: git-pull.sh:271\n #, sh-format\n msgid \"\"\n@@ -9835,7 +9802,6 @@ msgstr \"\"\n msgid \"Changes from $mb to $onto:\"\n msgstr \"\"\n\n-#. Detach HEAD and reset the tree\n #: git-rebase.sh:609\n msgid \"First, rewinding head to replay your work on top of it...\"\n msgstr \"\"\n@@ -10218,7 +10184,6 @@ msgstr \"\"\n msgid \"The --cached option cannot be used with the --files option\"\n msgstr \"\"\n\n-#. unexpected type\n #: git-submodule.sh:1097\n #, sh-format\n msgid \"unexpected mode $mod_dst\"\n\n\n-- \nJiang Xin\n"},{"id":"239006","messageId":"CANYiYbGqKOj6HRipQQWD5ZFUDHBNUFwj4hh-HoqsDbfStPy-oQ@mail.gmail.com","threadId":"36428","inReplyTo":"CAN7MxmV5tzvGTTG+aOL73fLhbXc7YeOWvYwLkMyad0=mvffMHQ@mail.gmail.com","subject":"Re: [l10n] date: Note for translators not included in .po files","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2014-04-17T06:27:28Z","receivedAt":"2014-04-17T06:27:28Z","isPatch":false,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2014-04-17 6:51 GMT+08:00 Brian Gesiak <modocache@gmail.com>:\n> According to po/README, the l10n coordinator is responsible\n> for updating the git.pot file. Would it be possible to update it based\n> on v1.9.2 and include the above comment?\n>\n\nI have pushed a polished \"git.pot\" to the maint branch of git-l10n/git-po.\nIt's based on Git v1.9.2, and you can get it from:\n\n    https://github.com/git-l10n/git-po/blob/maint/po/git.pot\n\nBut if you want to translate for the upcoming Git v2.0.0, you can use\n\"git.pot\" in the \"pu\" branch as a template. See:\n\n    https://github.com/git-l10n/git-po/blob/pu/po/git.pot\n\n> By the way, I am trying to organize contributors to produce a Japanese\n> localization for Core Git. Currently we have plenty of interest but\n> only two contributors. If you or anyone you know would like to contribute\n> please visit the repository here: https://github.com/modocache/git-po-ja\n>\n> Thanks!\n>\n> - Brian Gesiak\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n\n\n-- \n蒋鑫\n\n北京群英汇信息技术有限公司\n邮件: worldhello.net@gmail.com\n网址: http://www.ossxp.com/\n博客: http://www.worldhello.net/\n微博: http://weibo.com/gotgit/\n电话: 18601196889\n"},{"id":"239029","messageId":"xmqqk3anesml.fsf@gitster.dls.corp.google.com","threadId":"36428","inReplyTo":"2ce9ec406501d112e032c8208417f8100bed04c6.1397712142.git.worldhello.net@gmail.com","subject":"Re: [PATCH 2/3] i18n: Only extract comments marked by special tag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-04-17T18:08:18Z","receivedAt":"2014-04-17T18:08:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jiang Xin <worldhello.net@gmail.com> writes:\n\n> When extract l10n messages, we use \"--add-comments\" option to keep\n> comments right above the l10n messages for references.  But sometimes\n> irrelevant comments are also extracted.  For example in the following\n> code block, the comment in line 2 will be extracted as comment for the\n> l10n message in line 3, but obviously it's wrong.\n>\n>         { OPTION_CALLBACK, 0, \"ignore-removal\", &addremove_explicit,\n>           NULL /* takes no arguments */,\n>           N_(\"ignore paths removed in the working tree (same as\n>           --no-all)\"),\n>           PARSE_OPT_NOARG, ignore_removal_cb },\n>\n> Since almost all comments for l10n translators are marked with the same\n> prefix (tag): \"TRANSLATORS:\", it's safe to only extract comments with\n> this special tag.  I.E. it's better to call xgettext as:\n>\n>         xgettext --add-comments=TRANSLATORS: ...\n>\n> Also tweaks the multi-line comment in \"init-db.c\", to make it start with\n> the proper tag, not \"* TRANSLATORS:\" (which has a star before the tag).\n\nHmph.\n\nI am not very happy with this change, as it would force us to\nspecial case \"Translators\" comment to follow a non-standard\nmulti-line comment formatting convention.  Is there a way to tell\nxgettext to accept both of these forms?\n\n        /* TRANSLATORS: this is a short comment to help you */\n        _(\"foo bar\");\n\n        /*\n         * TRANSLATORS: this comment is to help you, but it is\n         * a lot longer to fit on just a single line.\n         */\n        _(\"bar baz\");\n\n\n>\n> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>\n> ---\n>  Makefile          | 2 +-\n>  builtin/init-db.c | 8 +++-----\n>  2 files changed, 4 insertions(+), 6 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 2128ce3..a53f3a8 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -2102,7 +2102,7 @@ pdf:\n>  \n>  XGETTEXT_FLAGS = \\\n>  \t--force-po \\\n> -\t--add-comments \\\n> +\t--add-comments=TRANSLATORS: \\\n>  \t--msgid-bugs-address=\"Git Mailing List <git@vger.kernel.org>\" \\\n>  \t--from-code=UTF-8\n>  XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \\\n> diff --git a/builtin/init-db.c b/builtin/init-db.c\n> index c7c76bb..56f85e2 100644\n> --- a/builtin/init-db.c\n> +++ b/builtin/init-db.c\n> @@ -412,11 +412,9 @@ int init_db(const char *template_dir, unsigned int flags)\n>  \tif (!(flags & INIT_DB_QUIET)) {\n>  \t\tint len = strlen(git_dir);\n>  \n> -\t\t/*\n> -\t\t * TRANSLATORS: The first '%s' is either \"Reinitialized\n> -\t\t * existing\" or \"Initialized empty\", the second \" shared\" or\n> -\t\t * \"\", and the last '%s%s' is the verbatim directory name.\n> -\t\t */\n> +\t\t/* TRANSLATORS: The first '%s' is either \"Reinitialized\n> +\t\t   existing\" or \"Initialized empty\", the second \" shared\" or\n> +\t\t   \"\", and the last '%s%s' is the verbatim directory name. */\n>  \t\tprintf(_(\"%s%s Git repository in %s%s\\n\"),\n>  \t\t       reinit ? _(\"Reinitialized existing\") : _(\"Initialized empty\"),\n>  \t\t       shared_repository ? _(\" shared\") : \"\",\n"},{"id":"239030","messageId":"xmqqfvlbesgf.fsf@gitster.dls.corp.google.com","threadId":"36428","inReplyTo":"CANYiYbGUKiOyoBOPHH+jvdZx1hKoUshh7O0KnpWUQEzbvd8TfQ@mail.gmail.com","subject":"Re: [PATCH 0/3] extract proper comments for l10n translators","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-04-17T18:12:00Z","receivedAt":"2014-04-17T18:12:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jiang Xin <worldhello.net@gmail.com> writes:\n\n> 2014-04-17 13:37 GMT+08:00 Jiang Xin <worldhello.net@gmail.com>:\n>> When generate git.pot, many irrelevant comments are extracted as references\n>> for translators, but one useful comment is lost.  This series patches will\n>> fix this issue.\n>\n> Brief changes of po/git.pot after applied these patches:\n\nThis is a very good way to make sure that 2/3 does not lose helpful\ncomments.\n\nThanks, but my complaint regarding the multi-line comment format\nstill stands.\n\n>\n> diff --git a/po/git.pot b/po/git.pot\n> index f70b46b..9e474f3 100644\n> --- a/po/git.pot\n> +++ b/po/git.pot\n> @@ -23,10 +23,6 @@ msgstr \"\"\n>  msgid \"hint: %.*s\\n\"\n>  msgstr \"\"\n>\n> -#.\n> -#. * Message used both when 'git commit' fails and when\n> -#. * other commands doing a merge do.\n> -#.\n>  #: advice.c:85\n>  msgid \"\"\n>  \"Fix them up in the work tree,\\n\"\n> @@ -399,6 +395,7 @@ msgid_plural \"%lu years\"\n>  msgstr[0] \"\"\n>  msgstr[1] \"\"\n>\n> +#. TRANSLATORS: \"%s\" is \"<n> years\"\n>  #: date.c:149\n>  #, c-format\n>  msgid \"%s, %lu month ago\"\n> @@ -582,8 +579,6 @@ msgstr \"\"\n>  msgid \"Removing %s to make room for subdirectory\\n\"\n>  msgstr \"\"\n>\n> -#. something else exists\n> -#. .. but not some other error (who really cares what?)\n>  #: merge-recursive.c:700 merge-recursive.c:721\n>  msgid \": perhaps a D/F conflict?\"\n>  msgstr \"\"\n> @@ -899,11 +894,6 @@ msgstr \"\"\n>  msgid \"Pathspec '%s' is in submodule '%.*s'\"\n>  msgstr \"\"\n>\n> -#.\n> -#. * We may want to substitute \"this command\" with a command\n> -#. * name. E.g. when add--interactive dies when running\n> -#. * \"checkout -p\"\n> -#.\n>  #: pathspec.c:353\n>  #, c-format\n>  msgid \"%s: pathspec magic not supported by this command: %s\"\n> @@ -953,11 +943,6 @@ msgstr \"\"\n>  msgid \"%s tracks both %s and %s\"\n>  msgstr \"\"\n>\n> -#.\n> -#. * This last possibility doesn't occur because\n> -#. * FETCH_HEAD_IGNORE entries always appear at\n> -#. * the end of the list.\n> -#.\n>  #: remote.c:774\n>  msgid \"Internal error\"\n>  msgstr \"\"\n> @@ -1306,13 +1291,11 @@ msgstr \"\"\n>  msgid \"Could not find section in .gitmodules where path=%s\"\n>  msgstr \"\"\n>\n> -#. Maybe the user already did that, don't error out here\n>  #: submodule.c:76\n>  #, c-format\n>  msgid \"Could not update .gitmodules entry %s\"\n>  msgstr \"\"\n>\n> -#. Maybe the user already did that, don't error out here\n>  #: submodule.c:109\n>  #, c-format\n>  msgid \"Could not remove .gitmodules entry for %s\"\n> @@ -1884,7 +1867,6 @@ msgstr \"\"\n>  msgid \"add changes from all tracked and untracked files\"\n>  msgstr \"\"\n>\n> -#. takes no arguments\n>  #: builtin/add.c:260\n>  msgid \"ignore paths removed in the working tree (same as --no-all)\"\n>  msgstr \"\"\n> @@ -2044,7 +2026,6 @@ msgstr \"\"\n>  msgid \"corrupt binary patch at line %d: %.*s\"\n>  msgstr \"\"\n>\n> -#. there has to be one hunk (forward hunk)\n>  #: builtin/apply.c:1900\n>  #, c-format\n>  msgid \"unrecognized binary patch at line %d\"\n> @@ -2232,7 +2213,6 @@ msgstr \"\"\n>  msgid \"internal error\"\n>  msgstr \"\"\n>\n> -#. Say this even without --verbose\n>  #: builtin/apply.c:4043\n>  #, c-format\n>  msgid \"Applying patch %%s with %d reject...\"\n> @@ -3232,7 +3212,6 @@ msgstr \"\"\n>  msgid \" ... and %d more.\\n\"\n>  msgstr \"\"\n>\n> -#. The singular version\n>  #: builtin/checkout.c:711\n>  #, c-format\n>  msgid \"\"\n> @@ -3280,7 +3259,6 @@ msgstr \"\"\n>  msgid \"invalid reference: %s\"\n>  msgstr \"\"\n>\n> -#. case (1): want a tree\n>  #: builtin/checkout.c:1002\n>  #, c-format\n>  msgid \"reference is not a tree: %s\"\n> @@ -4276,7 +4254,6 @@ msgstr \"\"\n>  msgid \"GPG sign commit\"\n>  msgstr \"\"\n>\n> -#. end commit message options\n>  #: builtin/commit.c:1508\n>  msgid \"Commit contents options\"\n>  msgstr \"\"\n> @@ -5140,7 +5117,6 @@ msgstr \"\"\n>  msgid \"See \\\"git help gc\\\" for manual housekeeping.\\n\"\n>  msgstr \"\"\n>\n> -#. be quiet on --auto\n>  #: builtin/gc.c:336\n>  #, c-format\n>  msgid \"\"\n> @@ -5894,12 +5870,10 @@ msgstr \"\"\n>  msgid \"unable to move %s to %s\"\n>  msgstr \"\"\n>\n> -#.\n> -#. * TRANSLATORS: The first '%s' is either \"Reinitialized\n> -#. * existing\" or \"Initialized empty\", the second \" shared\" or\n> -#. * \"\", and the last '%s%s' is the verbatim directory name.\n> -#.\n> -#: builtin/init-db.c:420\n> +#. TRANSLATORS: The first '%s' is either \"Reinitialized\n> +#. existing\" or \"Initialized empty\", the second \" shared\" or\n> +#. \"\", and the last '%s%s' is the verbatim directory name.\n> +#: builtin/init-db.c:418\n>  #, c-format\n>  msgid \"%s%s Git repository in %s%s\\n\"\n>  msgstr \"\"\n> @@ -6627,7 +6601,6 @@ msgstr \"\"\n>  msgid \"Commit %s has a bad GPG signature allegedly by %s.\"\n>  msgstr \"\"\n>\n> -#. 'N'\n>  #: builtin/merge.c:1279\n>  #, c-format\n>  msgid \"Commit %s does not have a GPG signature.\"\n> @@ -9593,8 +9566,6 @@ msgstr \"\"\n>  msgid \"'git bisect bad' can take only one argument.\"\n>  msgstr \"\"\n>\n> -#. have bad but not good.  we could bisect although\n> -#. this is less optimum.\n>  #: git-bisect.sh:273\n>  msgid \"Warning: bisecting only with a bad commit.\"\n>  msgstr \"\"\n> @@ -9690,10 +9661,6 @@ msgstr \"\"\n>  msgid \"updating an unborn branch with changes added to the index\"\n>  msgstr \"\"\n>\n> -#. The fetch involved updating the current branch.\n> -#. The working tree and the index file is still based on the\n> -#. $orig_head commit, but we are merging into $curr_head.\n> -#. First update the working tree to match $curr_head.\n>  #: git-pull.sh:271\n>  #, sh-format\n>  msgid \"\"\n> @@ -9835,7 +9802,6 @@ msgstr \"\"\n>  msgid \"Changes from $mb to $onto:\"\n>  msgstr \"\"\n>\n> -#. Detach HEAD and reset the tree\n>  #: git-rebase.sh:609\n>  msgid \"First, rewinding head to replay your work on top of it...\"\n>  msgstr \"\"\n> @@ -10218,7 +10184,6 @@ msgstr \"\"\n>  msgid \"The --cached option cannot be used with the --files option\"\n>  msgstr \"\"\n>\n> -#. unexpected type\n>  #: git-submodule.sh:1097\n>  #, sh-format\n>  msgid \"unexpected mode $mod_dst\"\n"},{"id":"239060","messageId":"CANYiYbGkjpdrzE25iRS33sm1=AodiREqWmJVkKVEok4mb4G5mQ@mail.gmail.com","threadId":"36428","inReplyTo":"xmqqk3anesml.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 2/3] i18n: Only extract comments marked by special tag","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2014-04-18T06:03:06Z","receivedAt":"2014-04-18T06:03:06Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2014-04-18 2:08 GMT+08:00 Junio C Hamano <gitster@pobox.com>:\n> Jiang Xin <worldhello.net@gmail.com> writes:\n>\n>> When extract l10n messages, we use \"--add-comments\" option to keep\n>> comments right above the l10n messages for references.  But sometimes\n>> irrelevant comments are also extracted.  For example in the following\n>> code block, the comment in line 2 will be extracted as comment for the\n>> l10n message in line 3, but obviously it's wrong.\n>>\n>>         { OPTION_CALLBACK, 0, \"ignore-removal\", &addremove_explicit,\n>>           NULL /* takes no arguments */,\n>>           N_(\"ignore paths removed in the working tree (same as\n>>           --no-all)\"),\n>>           PARSE_OPT_NOARG, ignore_removal_cb },\n>>\n>> Since almost all comments for l10n translators are marked with the same\n>> prefix (tag): \"TRANSLATORS:\", it's safe to only extract comments with\n>> this special tag.  I.E. it's better to call xgettext as:\n>>\n>>         xgettext --add-comments=TRANSLATORS: ...\n>>\n>> Also tweaks the multi-line comment in \"init-db.c\", to make it start with\n>> the proper tag, not \"* TRANSLATORS:\" (which has a star before the tag).\n>\n> Hmph.\n>\n> I am not very happy with this change, as it would force us to\n> special case \"Translators\" comment to follow a non-standard\n> multi-line comment formatting convention.  Is there a way to tell\n> xgettext to accept both of these forms?\n>\n>         /* TRANSLATORS: this is a short comment to help you */\n>         _(\"foo bar\");\n>\n>         /*\n>          * TRANSLATORS: this comment is to help you, but it is\n>          * a lot longer to fit on just a single line.\n>          */\n>         _(\"bar baz\");\n>\n\nWe can not provide multiple `--add-comments=TAG` options to xgettext,\nbecause xgettext holds the tag in one string, not in a list:\n\n        /* Tag used in comment of prevailing domain.  */\n        static char *comment_tag;\n\nSo if we won't change our multi-line comments for translators, must\nhack gettext in some ways.\n\nThere maybe 3 ways to hack gettext:\n\n1. When matching comments against TAG, using strstr not strncmp.\n\n        2360         /* When the comment tag is seen, it drags in not\nonly the line\n        2361            which it starts, but all remaining comment lines.  */\n        2362         if (add_all_remaining_comments\n        2363             || (add_all_remaining_comments =\n        2364                   (comment_tag != NULL\n        2365                    && strncmp (s, comment_tag, strlen\n(comment_tag)) == 0)))\n\n2. Add a extension to in-comment xgettext instructions.\n\n    There is a undocumented feature in xgettext: User can provide\n    instructions (prefixed by xgettext:) in comments, such as:\n\n        /*\n         * xgettext: fuzzy possible-c-format no-wrap\n         * other comments...\n         */\n\n    But it does not help much, unless we hack xgettext to extend this\n    hidden feature. I.E. Add an additional flag to support unconditionally\n    reference to the commit block. Like:\n\n        /*\n         * xgettext: comments\n         * TRANSLATORS: this comment is to help you, but it is\n         * a lot longer to fit on just a single line.\n         */\n         _(\"bar baz\");\n\n3. Hack the parser for comments in \"gettext-tools/src/x-c.c\" (maybe\n    function phase4_getc()) to support various multi-line comments style,\n    such as:\n\n        /*\n         * TRANSLATORS: this comment is to help you, but it is\n         * a lot longer to fit on just a single line.\n         */\n\n        /*\n        ** TRANSLATORS: this comment is to help you, but it is\n        ** a lot longer to fit on just a single line.\n        */\n\n        /********************************************************\n         * TRANSLATORS: this comment is to help you, but it is  *\n         * a lot longer to fit on just a single line.           *\n         ********************************************************/\n\n\nI CC this mail to the gettext mailing list. Full thread see:\n\n * http://thread.gmane.org/gmane.comp.version-control.git/246390/focus=246431\n\n-- \nJiang Xin\n"},{"id":"239072","messageId":"xmqqha5qd1hl.fsf@gitster.dls.corp.google.com","threadId":"36428","inReplyTo":"CANYiYbGkjpdrzE25iRS33sm1=AodiREqWmJVkKVEok4mb4G5mQ@mail.gmail.com","subject":"Re: [PATCH 2/3] i18n: Only extract comments marked by special tag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-04-18T16:52:06Z","receivedAt":"2014-04-18T16:52:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jiang Xin <worldhello.net@gmail.com> writes:\n\n>> I am not very happy with this change, as it would force us to\n>> special case \"Translators\" comment to follow a non-standard\n>> multi-line comment formatting convention.  Is there a way to tell\n>> xgettext to accept both of these forms?\n>>\n>>         /* TRANSLATORS: this is a short comment to help you */\n>>         _(\"foo bar\");\n>>\n>>         /*\n>>          * TRANSLATORS: this comment is to help you, but it is\n>>          * a lot longer to fit on just a single line.\n>>          */\n>>         _(\"bar baz\");\n>>\n>\n> We can not provide multiple `--add-comments=TAG` options to xgettext,\n> because xgettext holds the tag in one string, not in a list:\n>\n>         /* Tag used in comment of prevailing domain.  */\n>         static char *comment_tag;\n>\n> So if we won't change our multi-line comments for translators, must\n> hack gettext in some ways.\n>\n> There maybe 3 ways to hack gettext:\n> ...\n> I CC this mail to the gettext mailing list. Full thread see:\n>\n>  * http://thread.gmane.org/gmane.comp.version-control.git/246390/focus=246431\n\nThis is one of these times when I find myself very fortunate for\nbeing surrounded by competent contributors with good tastes, which I\nmay not deserve ;-)\n\nThanks for being thorough.\n\nHaving said that, it is only just a single comment, and it is too\nmuch hassle to even think about what to do in the meantime while we\nwait until such a change happens and an updated version of gettext\nreaches everybody.  Let's take 2/3 as-is.\n\nDocumentation/CodingGuidelines may want to have a sentence of two to\nexplain this, though.\n\n Documentation/CodingGuidelines | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines\nindex dab5c61..b367a85 100644\n--- a/Documentation/CodingGuidelines\n+++ b/Documentation/CodingGuidelines\n@@ -159,10 +159,19 @@ For C programs:\n  - Multi-line comments include their delimiters on separate lines from\n    the text.  E.g.\n \n \t/*\n \t * A very long\n \t * multi-line comment.\n \t */\n \n+   Note however that a multi-line comment that explains a translatable\n+   string to translators uses a different convention of starting with a\n+   magic token \"TRANSLATORS: \" immediately after the opening delimiter,\n+   and without an asterisk at the beginning of each line.  E.g.\n+\n+\t/* TRANSLATORS: here is a comment that explains the string\n+\t   to be translated, that follows immediately after it */\n+\t_(\"Here is a translatable string explained by the above.\");\n+\n  - Double negation is often harder to understand than no negation\n    at all.\n"},{"id":"239076","messageId":"xmqqy4z2bkbr.fsf@gitster.dls.corp.google.com","threadId":"36428","inReplyTo":"xmqqha5qd1hl.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 2/3] i18n: Only extract comments marked by special tag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-04-18T17:48:08Z","receivedAt":"2014-04-18T17:48:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Documentation/CodingGuidelines may want to have a sentence of two to\n> explain this, though.\n\nAfter re-reading what I sent out, I realized that the way I singled\nout multi-line comments was misleading.  Here is an updated version.\n\n-- >8 --\nSubject: [PATCH] i18n: mention \"TRANSLATORS:\" marker in Documentation/CodingGuidelines\n\nThese comments have to have \"TRANSLATORS: \" at the very beginning\nand have to deviate from the usual multi-line comment formatting\nconvention.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/CodingGuidelines | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines\nindex dab5c61..f9b8bff 100644\n--- a/Documentation/CodingGuidelines\n+++ b/Documentation/CodingGuidelines\n@@ -164,6 +164,16 @@ For C programs:\n \t * multi-line comment.\n \t */\n \n+   Note however that a comment that explains a translatable string to\n+   translators uses a convention of starting with a magic token\n+   \"TRANSLATORS: \" immediately after the opening delimiter, even when\n+   it spans multiple lines.  We do not add an asterisk at the beginning\n+   of each line, either.  E.g.\n+\n+\t/* TRANSLATORS: here is a comment that explains the string\n+\t   to be translated, that follows immediately after it */\n+\t_(\"Here is a translatable string explained by the above.\");\n+\n  - Double negation is often harder to understand than no negation\n    at all.\n \n-- \n1.9.2-651-g78816bc\n"}]}