Skip to contentSkip to conversation

fsck: use Q_() for the verbose connectivity message

PATCH In review Aniket Gupta 2 participants 2 messages Oct 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsck: use Q_() for the verbose connectivity message

The verbose "Checking connectivity" message has the word "objects" hardcoded as a plural inside a plain _(), so translators can't give the right form for the number. Use Q_() like the other count messages so gettext can pick it. English output stays the same.

---
The number printed here comes from the hash table size in get_max_object_index() and not a real object count, so it never says 1. Left that alone, can look at it separately if people think it's worth it.

 builtin/fsck.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
builtin/fsck.c +4 -1
index 9af4cc085..fedf8f853 100644
@@ -379,7 +379,10 @@ static void check_connectivity(struct repository *repo)
 	/* Look up all the requirements, warn about missing objects.. */
 	max = get_max_object_index(repo);
 	if (verbose)
-		fprintf_ln(stderr, _("Checking connectivity (%d objects)"), max);
+		fprintf_ln(stderr, Q_("Checking connectivity (%d object)",
+				      "Checking connectivity (%d objects)",
+				      max),
+			   max);
 
 	for (i = 0; i < max; i++) {
 		struct object *obj = get_indexed_object(repo, i);
Signature · 1 line
2.56.0.186.gc51408889.dirty
#1 lore raw
Quoted 11 lines · Aniket Gupta

The verbose "Checking connectivity" message has the word "objects" hardcoded as a plural inside a plain _(), so translators can't give the right form for the number. Use Q_() like the other count messages so gettext can pick it. English output stays the same.

---
The number printed here comes from the hash table size in get_max_object_index() and not a real object count, so it never says 1. Left that alone, can look at it separately if people think it's worth it.

The size of the hashtable we use ought to be comfortably larger than the actual number of objects we are looking at for the hashtable to perform well, so the number we are showing indeed is not the actual number of objects. Nevertheless, using Q_() is the right thing to do here, especially to support languages with more complex plural forms.

We _could_ add a NEEDSWORK comment near there to say that future developers may want to think about the number being inaccurate and do something about it (or not), but I think your decision not to address the inaccuracies in this patch even though you noticed it is the right one.

Will queue. Thanks.

Quoted 19 lines
 builtin/fsck.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
builtin/fsck.c +4 -1
index 9af4cc085..fedf8f853 100644
@@ -379,7 +379,10 @@ static void check_connectivity(struct repository *repo)
 	/* Look up all the requirements, warn about missing objects.. */
 	max = get_max_object_index(repo);
 	if (verbose)
-		fprintf_ln(stderr, _("Checking connectivity (%d objects)"), max);
+		fprintf_ln(stderr, Q_("Checking connectivity (%d object)",
+				      "Checking connectivity (%d objects)",
+				      max),
+			   max);
 
 	for (i = 0; i < max; i++) {
 		struct object *obj = get_indexed_object(repo, i);