path: root/ref-filter.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 /ref-filter.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 'ref-filter.c')
1 files changed, 8 insertions, 4 deletions
diff --git a/ref-filter.c b/ref-filter.c
index 3a64044..5632841 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1251,13 +1251,17 @@ char *get_head_description(void)
else if (state.detached_from) {
if (state.detached_at)
- /* TRANSLATORS: make sure this matches
- "HEAD detached at " in wt-status.c */
+ /*
+ * TRANSLATORS: make sure this matches "HEAD
+ * detached at " in wt-status.c
+ */
strbuf_addf(&desc, _("(HEAD detached at %s)"),
- /* TRANSLATORS: make sure this matches
- "HEAD detached from " in wt-status.c */
+ /*
+ * TRANSLATORS: make sure this matches "HEAD
+ * detached from " in wt-status.c
+ */
strbuf_addf(&desc, _("(HEAD detached from %s)"),