From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Jonathan Niedier" <jrnieder@gmail.com>,
"Ævar Arnfjörð" <avarab@gmail.com>,
"Jiang Xin" <worldhello.net@gmail.com>,
"Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 08/10] i18n: apply: update say_patch_name to give translators complete sentence
Date: Mon, 23 Apr 2012 19:30:28 +0700 [thread overview]
Message-ID: <1335184230-8870-9-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1335184230-8870-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
builtin/apply.c | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 4bb6354..c768b7f 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -335,22 +335,25 @@ static void clear_image(struct image *image)
image->len = 0;
}
-static void say_patch_name(FILE *output, const char *pre,
- struct patch *patch, const char *post)
+/* fmt must contain _one_ %s and no other substitution */
+static void say_patch_name(FILE *output, const char *fmt, struct patch *patch)
{
- fputs(pre, output);
+ struct strbuf sb = STRBUF_INIT;
+
if (patch->old_name && patch->new_name &&
strcmp(patch->old_name, patch->new_name)) {
- quote_c_style(patch->old_name, NULL, output, 0);
- fputs(" => ", output);
- quote_c_style(patch->new_name, NULL, output, 0);
+ quote_c_style(patch->old_name, &sb, NULL, 0);
+ strbuf_addstr(&sb, " => ");
+ quote_c_style(patch->new_name, &sb, NULL, 0);
} else {
const char *n = patch->new_name;
if (!n)
n = patch->old_name;
- quote_c_style(n, NULL, output, 0);
+ quote_c_style(n, &sb, NULL, 0);
}
- fputs(post, output);
+ fprintf(output, fmt, sb.buf);
+ fputc('\n', output);
+ strbuf_release(&sb);
}
#define CHUNKSIZE (8192)
@@ -3172,7 +3175,7 @@ static int check_patch_list(struct patch *patch)
while (patch) {
if (apply_verbosely)
say_patch_name(stderr,
- "Checking patch ", patch, "...\n");
+ _("Checking patch %s..."), patch);
err |= check_patch(patch);
patch = patch->next;
}
@@ -3536,6 +3539,7 @@ static int write_out_one_reject(struct patch *patch)
char namebuf[PATH_MAX];
struct fragment *frag;
int cnt = 0;
+ struct strbuf sb = STRBUF_INIT;
for (cnt = 0, frag = patch->fragments; frag; frag = frag->next) {
if (!frag->rejected)
@@ -3546,7 +3550,7 @@ static int write_out_one_reject(struct patch *patch)
if (!cnt) {
if (apply_verbosely)
say_patch_name(stderr,
- "Applied patch ", patch, " cleanly.\n");
+ _("Applied patch %s cleanly."), patch);
return 0;
}
@@ -3557,8 +3561,12 @@ static int write_out_one_reject(struct patch *patch)
die(_("internal error"));
/* Say this even without --verbose */
- say_patch_name(stderr, "Applying patch ", patch, " with");
- fprintf(stderr, " %d rejects...\n", cnt);
+ strbuf_addf(&sb, Q_("Applying patch %%s with %d reject...",
+ "Applying patch %%s with %d rejects...",
+ cnt),
+ cnt);
+ say_patch_name(stderr, sb.buf, patch);
+ strbuf_release(&sb);
cnt = strlen(patch->new_name);
if (ARRAY_SIZE(namebuf) <= cnt + 5) {
--
1.7.8.36.g69ee2
next prev parent reply other threads:[~2012-04-23 12:35 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-23 12:30 [PATCH 00/10] i18n relative dates, help, remote, apply, index-pack and bundle Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 01/10] Makefile: feed all header files to xgettext Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 02/10] Add three convenient format printing functions with \n automatically appended Nguyễn Thái Ngọc Duy
2012-04-23 16:15 ` Jonathan Nieder
2012-04-23 12:30 ` [PATCH 03/10] i18n: mark relative dates for translation Nguyễn Thái Ngọc Duy
2012-04-24 20:04 ` Junio C Hamano
2012-04-25 10:46 ` Nguyen Thai Ngoc Duy
2012-04-25 11:07 ` Johannes Sixt
2012-04-25 11:25 ` Zbigniew Jędrzejewski-Szmek
2012-04-25 11:29 ` Nguyen Thai Ngoc Duy
2012-04-25 15:25 ` Jonathan Nieder
2012-04-25 16:27 ` Junio C Hamano
2012-04-25 17:26 ` Jonathan Nieder
2012-04-23 12:30 ` [PATCH 04/10] i18n: help: mark strings " Nguyễn Thái Ngọc Duy
2012-04-23 16:30 ` Jonathan Nieder
2012-04-23 18:18 ` Junio C Hamano
2012-04-23 18:34 ` Jonathan Nieder
2012-04-25 11:21 ` [PATCH] help: replace underlining "help -a" headers using hyphens with a blank line Nguyễn Thái Ngọc Duy
2012-04-25 17:30 ` Junio C Hamano
2012-04-23 12:30 ` [PATCH 05/10] i18n: make warn_dangling_symref() automatically append \n Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 06/10] i18n: remote: mark strings for translation Nguyễn Thái Ngọc Duy
2012-04-25 22:54 ` Junio C Hamano
2012-04-26 1:12 ` Nguyen Thai Ngoc Duy
2012-04-23 12:30 ` [PATCH 07/10] i18n: apply: " Nguyễn Thái Ngọc Duy
2012-04-25 22:50 ` Junio C Hamano
2012-05-06 13:13 ` [PATCH] apply: remove lego in i18n string in gitdiff_verify_name Nguyễn Thái Ngọc Duy
2012-05-07 18:00 ` Junio C Hamano
2012-05-08 13:38 ` Nguyễn Thái Ngọc Duy
2012-05-08 17:07 ` Junio C Hamano
2012-05-09 12:29 ` Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` Nguyễn Thái Ngọc Duy [this message]
2012-04-23 12:30 ` [PATCH 09/10] i18n: index-pack: mark strings for translation Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 10/10] i18n: bundle: " Nguyễn Thái Ngọc Duy
2012-04-25 22:43 ` Junio C Hamano
2012-04-26 1:24 ` Nguyen Thai Ngoc Duy
2012-04-26 5:53 ` [PATCH] bundle: remove stray single-quote from error message Jonathan Nieder
2012-04-23 16:41 ` [PATCH 00/10] i18n relative dates, help, remote, apply, index-pack and bundle Jonathan Nieder
2012-04-23 18:56 ` Junio C Hamano
2012-04-23 20:06 ` Ævar Arnfjörð Bjarmason
2012-04-24 12:19 ` Nguyen Thai Ngoc Duy
2012-04-24 19:50 ` Junio C Hamano
2012-04-25 11:42 ` Nguyen Thai Ngoc Duy
2012-04-25 16:11 ` 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=1335184230-8870-9-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=worldhello.net@gmail.com \
--cc=zbyszek@in.waw.pl \
/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).