From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Jeff King" <peff@peff.net>, "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH] Revert diffstat back to English
Date: Thu, 13 Sep 2012 21:16:26 +0700 [thread overview]
Message-ID: <1347545786-936-1-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <20120913132847.GD4287@sigill.intra.peff.net>
This reverts the i18n part of 7f81463 (Use correct grammar in diffstat
summary line - 2012-02-01) but still keeps the grammar correctness for
English. It also reverts b354f11 (Fix tests under GETTEXT_POISON on
diffstat - 2012-08-27). The result is diffstat always in English
for all commands.
This helps stop users from accidentally sending localized
format-patch'd patches.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
On Thu, Sep 13, 2012 at 8:28 PM, Jeff King <peff@peff.net> wrote:
> 1. Revert diffstat to always be in English/C locale for now. For all
> commands. People too frequently end up showing the output of things
> besides format-patch. It means they will have to read the English
> when they are just running locally, but since format-patch is
> generating it, it is something that they would need to
> understand anyway.
The "for now" sounds reasonable. Minimum annoyance is always good
especially in a (largely?) volunteer-driven development environment
like git. So I revert the i18n effect. Note that I don't optimize the
changes for English only. The i18n might come back some day if we
find a good way to do it.
Git is still partly i18n-ized, turning a few strings back does not
seem a big regression.
> 2. If people on non-English projects find that too cumbersome, then we
> can switch the "English/C" above for `i18n.projectlang` or
> something. But it should not be per-command, but per-message, and
> should include all output that is not diagnostic and is not
> machine-parseable (e.g., what I mentioned above, request-pull
> output, etc). If it is the project's language, then the team
> members will need to know it anyway, so it should not be too big a
> burden to have a potentially different language there than in the
> diagnostic messages.
If you mean projectlang vs a local language, I looked into that and I
don't think we could support two non-C languages using standard
gettext interface. So it's either "C vs another", or make use of
unofficial gettext features, or roll your own.
diff.c | 10 ++++------
t/t4006-diff-mode.sh | 8 ++++----
t/t4202-log.sh | 2 +-
t/t4205-log-pretty-formats.sh | 4 ++--
t/t7508-status.sh | 2 +-
5 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/diff.c b/diff.c
index e6846ca..8c23b9c 100644
--- a/diff.c
+++ b/diff.c
@@ -1398,11 +1398,11 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
if (!files) {
assert(insertions == 0 && deletions == 0);
- return fprintf(fp, "%s\n", _(" 0 files changed"));
+ return fprintf(fp, "%s\n", " 0 files changed");
}
strbuf_addf(&sb,
- Q_(" %d file changed", " %d files changed", files),
+ files ? " %d files changed" : " %d file changed",
files);
/*
@@ -1419,8 +1419,7 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
* do not translate it.
*/
strbuf_addf(&sb,
- Q_(", %d insertion(+)", ", %d insertions(+)",
- insertions),
+ insertions ? ", %d insertions(+)" : ", %d insertion(+)",
insertions);
}
@@ -1430,8 +1429,7 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
* do not translate it.
*/
strbuf_addf(&sb,
- Q_(", %d deletion(-)", ", %d deletions(-)",
- deletions),
+ deletions ? ", %d deletions(-)" : ", %d deletion(-)",
deletions);
}
strbuf_addch(&sb, '\n');
diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh
index 3d4b1ba..7a3e1f9 100755
--- a/t/t4006-diff-mode.sh
+++ b/t/t4006-diff-mode.sh
@@ -36,24 +36,24 @@ test_expect_success '--stat output after text chmod' '
test_chmod -x rezrov &&
echo " 0 files changed" >expect &&
git diff HEAD --stat >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success '--shortstat output after text chmod' '
git diff HEAD --shortstat >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success '--stat output after binary chmod' '
test_chmod +x binbin &&
echo " 0 files changed" >expect &&
git diff HEAD --stat >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success '--shortstat output after binary chmod' '
git diff HEAD --shortstat >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_done
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 924ba53..b3ac6be 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -813,7 +813,7 @@ sanitize_output () {
test_expect_success 'log --graph with diff and stats' '
git log --graph --pretty=short --stat -p >actual &&
sanitize_output >actual.sanitized <actual &&
- test_i18ncmp expect actual.sanitized
+ test_cmp expect actual.sanitized
'
test_expect_success 'dotdot is a parent directory' '
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 2c45de7..4afd778 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -88,7 +88,7 @@ test_expect_success 'NUL separation with --stat' '
stat1_part=$(git diff --stat --root HEAD^) &&
printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n" >expected &&
git log -z --stat --pretty="format:%s" >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_failure 'NUL termination with --stat' '
@@ -96,7 +96,7 @@ test_expect_failure 'NUL termination with --stat' '
stat1_part=$(git diff --stat --root HEAD^) &&
printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n\0" >expected &&
git log -z --stat --pretty="tformat:%s" >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_done
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index e313ef1..c206f47 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -80,7 +80,7 @@ test_expect_success 'status --column' '
# dir1/untracked dir2/untracked untracked
# dir2/modified output
EOF
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >expect <<\EOF
--
1.7.12.396.g87e837f.dirty
next prev parent reply other threads:[~2012-09-13 14:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-25 19:26 [PATCH RFC 0/2] Mixing English and a local language Nguyễn Thái Ngọc Duy
2012-08-25 19:26 ` [PATCH 1/2] Allow to print diffstat in English regardless current locale Nguyễn Thái Ngọc Duy
2012-08-25 19:26 ` [PATCH 2/2] format-patch: always print diffstat in English Nguyễn Thái Ngọc Duy
2012-09-12 14:05 ` [PATCH RFC 0/2] Mixing English and a local language Nguyen Thai Ngoc Duy
2012-09-12 18:18 ` Junio C Hamano
2012-09-13 13:28 ` Jeff King
2012-09-13 14:16 ` Nguyễn Thái Ngọc Duy [this message]
2012-09-13 14:57 ` [PATCH] Revert diffstat back to English Jeff King
2012-09-13 17:39 ` Junio C Hamano
2012-09-13 18:40 ` Junio C Hamano
2012-09-13 21:01 ` Jeff King
2012-09-13 21:10 ` Junio C Hamano
2012-09-13 21:20 ` Jeff King
2012-09-13 21:26 ` Junio C Hamano
2012-09-13 21:31 ` Jeff King
2012-09-13 21:47 ` Junio C Hamano
2012-09-14 0:11 ` Jeff King
2012-09-14 11:56 ` Nguyen Thai Ngoc Duy
2012-09-14 16:54 ` Junio C Hamano
2012-09-15 2:41 ` Nguyen Thai Ngoc Duy
2012-09-13 17:30 ` [PATCH RFC 0/2] Mixing English and a local language Junio C Hamano
2012-09-13 17:52 ` Junio C Hamano
2012-09-13 18:04 ` Jeff King
2012-09-13 18:00 ` Jeff King
2012-09-14 10:41 ` Michael J Gruber
2012-09-14 11:35 ` Nguyen Thai Ngoc Duy
2012-09-14 12:40 ` [PATCH] Makefile: respect $LINGUAS variable on selecting .mo files to install Nguyễn Thái Ngọc Duy
2012-09-14 13:06 ` Michael J Gruber
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=1347545786-936-1-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).