Thread (53 messages) 53 messages, 6 authors, 2017-05-30

Re: [PATCH] C style: use standard style for "TRANSLATORS" comments

From: Brandon Williams <hidden>
Date: 2017-05-11 21:50:14

On 05/11, Jonathan Nieder wrote:
Hi,

Ævar Arnfjörð Bjarmason wrote:
quoted
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.
Hooray!

[...]
quoted
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -256,12 +256,12 @@ For C programs:
 
    Note however that a comment that explains a translatable string to
The "Note however" isn't needed since it's not contradicting
the previous point any more.  This can be an entirely separate item:

 - A comment that explains a translatable string to translators
   uses a convention of starting with a magic token "TRANSLATORS: "
   [etc]

It might even make sense to remove the explanation of TRANSLATORS
comments from this file altogether, since they're intuitive to use.
A more common place to want to learn about them is po/README, which
already explains them.

[...]
quoted
--- a/bisect.c
+++ b/bisect.c
@@ -995,8 +995,10 @@ int bisect_next_all(const char *prefix, int no_checkout)
 
 	steps_msg = xstrfmt(Q_("(roughly %d step)", "(roughly %d steps)",
 		  steps), steps);
-	/* TRANSLATORS: the last %s will be replaced with
-	   "(roughly %d steps)" translation */
+	/*
+	 * TRANSLATORS: the last %s will be replaced with "(roughly %d
+	 * steps)" translation.
+	 */
Nice.

[...]
quoted
+++ b/ref-filter.c
@@ -1251,13 +1251,17 @@ char *get_head_description(void)
 			    state.branch);
 	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
+			 */
optional: could treat "HEAD detached at " as an unbreakable phrase
for the sake of line-breaking, for easier grepping.

But what's here is also perfectly fine.

[...]
quoted
-			/* TRANSLATORS: make sure this matches
-			   "HEAD detached from " in wt-status.c */
+			/*
+			 * TRANSLATORS: make sure this matches "HEAD
+			 * detached from " in wt-status.c
+			 */
Likewise.

The rest also look good. This is great.
I agree with Jonathan.  I like having everything more uniform :)

-- 
Brandon Williams
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help