git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] i18n: format_tracking_info "Your branch is behind" message

From
Jiang Xin <worldhello.net@gmail.com>
Date
Feb 1, 2012, 17:21 UTC
Message-ID
<1328116914-61381-1-git-send-email-worldhello.net@gmail.com>

Function format_tracking_info in remote.c is called by wt_status_print_tracking in wt-status.c, which will print branch tracking message in git-status. git-checkout also show these messages through it's report_tracking function.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
---
 remote.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/remote.c b/remote.c
index 73a38..51853 100644
--- a/remote.c
+++ b/remote.c
@@ -1572,18 +1572,18 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
 	base = branch->merge[0]->dst;
 	base = shorten_unambiguous_ref(base, 0);
 	if (!num_theirs)
-		strbuf_addf(sb, "Your branch is ahead of '%s' "
-			    "by %d commit%s.\n",
-			    base, num_ours, (num_ours == 1) ? "" : "s");
+		strbuf_addf(sb, _("Your branch is ahead of '%s' "
+			    "by %d %s.\n"),
+			    base, num_ours, Q_("commit", "commits", num_ours));
 	else if (!num_ours)
-		strbuf_addf(sb, "Your branch is behind '%s' "
-			    "by %d commit%s, "
-			    "and can be fast-forwarded.\n",
-			    base, num_theirs, (num_theirs == 1) ? "" : "s");
+		strbuf_addf(sb, _("Your branch is behind '%s' "
+			    "by %d %s, "
+			    "and can be fast-forwarded.\n"),
+			    base, num_theirs, Q_("commit", "commits", num_theirs));
 	else
-		strbuf_addf(sb, "Your branch and '%s' have diverged,\n"
+		strbuf_addf(sb, _("Your branch and '%s' have diverged,\n"
 			    "and have %d and %d different commit(s) each, "
-			    "respectively.\n",
+			    "respectively.\n"),
 			    base, num_ours, num_theirs);
 	return 1;
 }
-- 
1.7.9.3.g1fbd7
Next: Ævar Arnfjörð Bjarmason
Message 1 of 2 in “i18n: format_tracking_info "Your branch is behind" message”
  1. i18n: format_tracking_info "Your branch is behind" messageJiang Xin, Feb 1, 2012
  2. Ævar Arnfjörð BjarmasonFeb 1, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.