From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Jonathan Nieder" <jrnieder@gmail.com>,
"Ævar Arnfjörð" <avarab@gmail.com>,
"Frederik Schwarzer" <schwarzerf@gmail.com>,
"Brandon Casey" <drafnel@gmail.com>
Subject: Re: [PATCH v2] Use correct grammar in diffstat summary line
Date: Thu, 2 Feb 2012 21:22:55 +0700 [thread overview]
Message-ID: <20120202142255.GA25871@do> (raw)
In-Reply-To: <7vhaza2qjw.fsf@alter.siamese.dyndns.org>
On Wed, Feb 01, 2012 at 01:26:43PM -0800, Junio C Hamano wrote:
> Nice. Will queue
Please also squash this in (resend looks ugly and it's hard to point
out changes). It makes the code look less ugly, use Q_() for gettext
poisoning and revert am input text back as Jonathan suggested.
I take it --summary is un-i18n-able, should we introduce.. umm..
--nice-summary or something that can support i18n?
-- 8< --
diff --git a/diff.c b/diff.c
index 5f3ce97..07c94f2 100644
--- a/diff.c
+++ b/diff.c
@@ -1325,6 +1325,7 @@ static void fill_print_name(struct diffstat_file *file)
int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
{
struct strbuf sb = STRBUF_INIT;
+ const char *fmt;
int ret;
if (!files) {
@@ -1332,10 +1333,8 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
return fputs(_(" 0 files changed\n"), fp);
}
- strbuf_addf(&sb,
- ngettext(" %d file changed", " %d files changed",
- files),
- files);
+ fmt = Q_(" %d file changed", " %d files changed", files);
+ strbuf_addf(&sb, fmt, files);
/*
* For binary diff, the caller may want to print "x files
@@ -1346,25 +1345,17 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
* but nothing about added/removed lines? Is this a bug in Git?").
*/
if (insertions || deletions == 0) {
- strbuf_addf(&sb,
- /*
- * TRANSLATORS: "+" in (+) is a line addition marker;
- * do not translate it.
- */
- ngettext(", %d insertion(+)", ", %d insertions(+)",
- insertions),
- insertions);
+ /* TRANSLATORS: "+" in (+) is a line addition marker,
+ do not translate it */
+ fmt = Q_(", %d insertion(+)", ", %d insertions(+)", insertions);
+ strbuf_addf(&sb, fmt, insertions);
}
if (deletions || insertions == 0) {
- strbuf_addf(&sb,
- /*
- * TRANSLATORS: "-" in (-) is a line removal marker;
- * do not translate it.
- */
- ngettext(", %d deletion(-)", ", %d deletions(-)",
- deletions),
- deletions);
+ /* TRANSLATORS: "-" in (-) is a line removal marker,
+ do not translate it */
+ fmt = Q_(", %d deletion(-)", ", %d deletions(-)", deletions);
+ strbuf_addf(&sb, fmt, deletions);
}
strbuf_addch(&sb, '\n');
ret = fputs(sb.buf, fp);
diff --git a/t/t0023-crlf-am.sh b/t/t0023-crlf-am.sh
index 18fe27b..12a3d78 100755
--- a/t/t0023-crlf-am.sh
+++ b/t/t0023-crlf-am.sh
@@ -12,7 +12,7 @@ Subject: test1
---
foo | 1 +
- 1 file changed, 1 insertion(+)
+ 1 files changed, 1 insertions(+)
create mode 100644 foo
diff --git a/foo b/foo
-- 8< --
--
Duy
next prev parent reply other threads:[~2012-02-02 14:23 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-31 14:24 [PATCH] Correct singular form in diff summary line for human interaction Nguyễn Thái Ngọc Duy
2012-01-31 15:20 ` Jonathan Nieder
2012-01-31 17:50 ` Junio C Hamano
2012-02-01 1:32 ` Nguyen Thai Ngoc Duy
2012-02-01 1:45 ` Thomas Dickey
2012-02-01 1:56 ` Thomas Dickey
2012-02-01 2:37 ` Nguyen Thai Ngoc Duy
2012-02-01 3:04 ` Junio C Hamano
2012-02-01 9:40 ` Thomas Dickey
2012-02-01 12:55 ` [PATCH v2] Use correct grammar in diffstat summary line Nguyễn Thái Ngọc Duy
2012-02-01 21:26 ` Junio C Hamano
2012-02-02 14:22 ` Nguyen Thai Ngoc Duy [this message]
2012-02-02 18:24 ` Junio C Hamano
2012-02-03 1:11 ` Nguyen Thai Ngoc Duy
2012-02-03 1:18 ` Junio C Hamano
2012-02-03 12:24 ` Jeff King
2012-02-01 23:35 ` Jonathan Nieder
2012-02-02 0:20 ` [RFC/PATCH] i18n: do not define gettext/ngettext in NO_GETTEXT case Jonathan Nieder
2012-02-02 0:27 ` [PATCH v2] Use correct grammar in diffstat summary line Jonathan Nieder
2012-02-02 0:31 ` Jonathan Nieder
2012-03-13 4:51 ` [RFC/PATCH 0/7] tests: diffstat summary line varies by locale (Re: [PATCH v2] Use correct grammar in diffstat summary line) Jonathan Nieder
2012-03-13 4:54 ` [PATCH 1/7] test: use test_i18ncmp when checking --stat output Jonathan Nieder
2012-03-13 6:00 ` Junio C Hamano
2012-03-13 6:05 ` Junio C Hamano
2012-03-13 6:13 ` Jonathan Nieder
2012-03-13 6:06 ` Jonathan Nieder
2012-03-13 4:58 ` [PATCH 2/7] test: use numstat instead of diffstat in funny-names test Jonathan Nieder
2012-03-13 4:59 ` [PATCH 3/7] test: modernize funny-names test style Jonathan Nieder
2012-03-13 5:00 ` [PATCH 4/7] test: test cherry-pick functionality and output separately Jonathan Nieder
2012-03-13 5:01 ` [PATCH 5/7] test: use --numstat instead of --stat in "git stash show" tests Jonathan Nieder
2012-03-13 5:02 ` [PATCH 6/7] test: use numstat instead of diffstat in binary-diff test Jonathan Nieder
2012-03-13 5:05 ` [PATCH 7/7] diffstat summary line varies by locale: miscellany Jonathan Nieder
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=20120202142255.GA25871@do \
--to=pclouds@gmail.com \
--cc=avarab@gmail.com \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=schwarzerf@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).