All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH/RFC 7/7] i18n: mark checkout plural warning for translation
Date: Sun, 10 Apr 2011 19:34:08 +0000	[thread overview]
Message-ID: <1302464048-21806-8-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <1302464048-21806-1-git-send-email-avarab@gmail.com>

Mark the "Warning: you are leaving %d commit(s) behind" message added
in v1.7.5-rc0~74^2 (commit: give final warning when reattaching HEAD
to leave commits behind) by Junio C Hamano for translation.

This message requires the use of ngettext() features, and is the first
message to use the Q_() wrapper around ngettext().

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/checkout.c         |   18 +++++++++++++++---
 t/t2020-checkout-detach.sh |   15 ++++++++++++---
 2 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 0b65edd..5e94720 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -648,18 +648,30 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
 		if (more == 1)
 			describe_one_orphan(&sb, last);
 		else
-			strbuf_addf(&sb, " ... and %d more.\n", more);
+			strbuf_addf(&sb, _(" ... and %d more.\n"), more);
 	}
 
 	fprintf(stderr,
-		"Warning: you are leaving %d commit%s behind, "
+		Q_(
+		/* The singular version */
+		"Warning: you are leaving %d commit behind, "
 		"not connected to\n"
 		"any of your branches:\n\n"
 		"%s\n"
 		"If you want to keep them by creating a new branch, "
 		"this may be a good time\nto do so with:\n\n"
 		" git branch new_branch_name %s\n\n",
-		lost, ((1 < lost) ? "s" : ""),
+		/* The plural version */
+		"Warning: you are leaving %d commits behind, "
+		"not connected to\n"
+		"any of your branches:\n\n"
+		"%s\n"
+		"If you want to keep them by creating a new branch, "
+		"this may be a good time\nto do so with:\n\n"
+		" git branch new_branch_name %s\n\n",
+		/* Give ngettext() the count */
+		lost),
+		lost,
 		sb.buf,
 		sha1_to_hex(commit->object.sha1));
 	strbuf_release(&sb);
diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh
index 569b27f..ab782e2 100755
--- a/t/t2020-checkout-detach.sh
+++ b/t/t2020-checkout-detach.sh
@@ -108,21 +108,30 @@ test_expect_success 'checkout warns on orphan commits' '
 	echo content >orphan &&
 	git add orphan &&
 	git commit -a -m orphan &&
-	git checkout master 2>stderr &&
+	git checkout master 2>stderr
+'
+
+test_expect_success C_LOCALE_OUTPUT 'checkout warns on orphan commits: output' '
 	check_orphan_warning stderr
 '
 
 test_expect_success 'checkout does not warn leaving ref tip' '
 	reset &&
 	git checkout --detach two &&
-	git checkout master 2>stderr &&
+	git checkout master 2>stderr
+'
+
+test_expect_success C_LOCALE_OUTPUT 'checkout does not warn leaving ref tip' '
 	check_no_orphan_warning stderr
 '
 
 test_expect_success 'checkout does not warn leaving reachable commit' '
 	reset &&
 	git checkout --detach HEAD^ &&
-	git checkout master 2>stderr &&
+	git checkout master 2>stderr
+'
+
+test_expect_success C_LOCALE_OUTPUT 'checkout does not warn leaving reachable commit' '
 	check_no_orphan_warning stderr
 '
 
-- 
1.7.4.1

  parent reply	other threads:[~2011-04-10 19:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-10 19:34 [PATCH/RFC 0/7] i18n: mark missing C messages Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 1/7] i18n: mark init-db messages for translation Ævar Arnfjörð Bjarmason
2011-04-12  7:12   ` Junio C Hamano
2011-04-12  7:15     ` Junio C Hamano
2011-04-12  7:44       ` Ævar Arnfjörð Bjarmason
2011-04-12 18:20         ` Junio C Hamano
2011-04-12 22:55           ` Junio C Hamano
2011-04-12 23:04             ` Junio C Hamano
2011-04-14 20:56               ` [PATCH] i18n: use test_i18n{grep,cmp} in t7508 Junio C Hamano
2011-04-10 19:34 ` [PATCH/RFC 2/7] i18n: mark merge "Could not read from" message for translation Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 3/7] i18n: mark merge "upstream" messages " Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 4/7] i18n: mark merge CHERRY_PICK_HEAD " Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 5/7] i18n: mark clone nonexistent repository message " Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 6/7] i18n: mark checkout --detach messages " Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` Ævar Arnfjörð Bjarmason [this message]
2011-04-12  7:19   ` [PATCH/RFC 7/7] i18n: mark checkout plural warning " Junio C Hamano
2011-04-12  7:54     ` Ævar Arnfjörð Bjarmason
2011-04-12 20:57       ` Junio C Hamano
2011-04-13  8:30         ` Ævar Arnfjörð Bjarmason
2011-04-13 15:55           ` Junio C Hamano
2011-04-12  7:27 ` [PATCH/RFC 0/7] i18n: mark missing C messages Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302464048-21806-8-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.