path: root/builtin/notes.c
diff options
authorÆvar Arnfjörð Bjarmason <>2017-05-11 21:20:12 (GMT)
committerJunio C Hamano <>2017-05-30 23:01:42 (GMT)
commit66f5f6dca95eda46bf02c8d06de8cb265995fd6e (patch)
treea88c446d3d22a03ba2c74a3001657bed91d5a749 /builtin/notes.c
parentb06d3643105c8758ed019125a4399cb7efdcce2c (diff)
C style: use standard style for "TRANSLATORS" comments
Change all the "TRANSLATORS: [...]" comments in the C code to use the regular Git coding style, and amend the style guide so that the example there uses that style. This custom style was necessary back in 2010 when the gettext support was initially added, and was subsequently documented in commit cbcfd4e3ea ("i18n: mention "TRANSLATORS:" marker in Documentation/CodingGuidelines", 2014-04-18). GNU xgettext hasn't had the parsing limitation that necessitated this exception for almost 3 years. Since its 0.19 release on 2014-06-02 it's been able to recognize TRANSLATOR comments in the standard Git comment syntax[1]. Usually we'd like to keep compatibility with software that's that young, but in this case literally the only person who needs to be using a gettext newer than 3 years old is Jiang Xin (the only person who runs & commits "make pot" results), so I think in this case we can make an exception. This xgettext parsing feature was added after a thread on the Git mailing list[2] which continued on the bug-gettext[3] list, but we never subsequently changed our style & styleguide, do so. There are already longstanding changes in git that use the standard comment style & have their TRANSLATORS comments extracted properly without getting the literal "*"'s mixed up in the text, as would happen before xgettext 0.19. Commit 7ff2683253 ("builtin-am: implement -i/--interactive", 2015-08-04) added one such comment, which in commit df0617bfa7 ("l10n: git.pot: v2.6.0 round 1 (123 new, 41 removed)", 2015-09-05) got picked up in the po/git.pot file with the right format, showing that Jiang already runs a modern xgettext. The xgettext parser does not handle the sort of non-standard comment style that I'm amending here in sequencer.c, but that isn't standard Git comment syntax anyway. With this change to sequencer.c & "make pot" the comment in the pot file is now correct: #. TRANSLATORS: %s will be "revert", "cherry-pick" or -#. * "rebase -i". +#. "rebase -i". 1. 2. <> ( 3. Signed-off-by: Ævar Arnfjörð Bjarmason <> Acked-by: Jiang Xin <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/notes.c')
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/notes.c b/builtin/notes.c
index 7b89147..fb856e5 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -340,8 +340,10 @@ static struct notes_tree *init_notes_check(const char *subcommand,
ref = (flags & NOTES_INIT_WRITABLE) ? t->update_ref : t->ref;
if (!starts_with(ref, "refs/notes/"))
- /* TRANSLATORS: the first %s will be replaced by a
- git notes command: 'add', 'merge', 'remove', etc.*/
+ /*
+ * TRANSLATORS: the first %s will be replaced by a git
+ * notes command: 'add', 'merge', 'remove', etc.
+ */
die(_("refusing to %s notes in %s (outside of refs/notes/)"),
subcommand, ref);
return t;