git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð" <avarab@gmail.com>,
	"Jiang Xin" <worldhello.net@gmail.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>
Subject: Re: [PATCH i18n 09/11] i18n: apply: update say_patch_name to give translators complete sentence
Date: Sun, 22 Apr 2012 18:42:25 +0200	[thread overview]
Message-ID: <4F9434F1.9000900@in.waw.pl> (raw)
In-Reply-To: <1334580603-11577-10-git-send-email-pclouds@gmail.com>

On 04/16/2012 02:50 PM, Nguyễn Thái Ngọc Duy wrote:
> ---
>  builtin/apply.c |   33 +++++++++++++++++++--------------
>  1 files changed, 19 insertions(+), 14 deletions(-)
> 
> diff --git a/builtin/apply.c b/builtin/apply.c
> index 6e9a02e..87922cf 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, struct patch *patch, const char *fmt)
>  {
> -	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);
> +	fprintf(output, "\n");
> +	strbuf_release(&sb);
>  }
>  
>  #define CHUNKSIZE (8192)
> @@ -3165,8 +3168,8 @@ static int check_patch_list(struct patch *patch)
>  	prepare_fn_table(patch);
>  	while (patch) {
>  		if (apply_verbosely)
> -			say_patch_name(stderr,
> -				       "Checking patch ", patch, "...\n");
> +			say_patch_name(stderr, patch,
> +				       _("Checking patch %s..."));
>  		err |= check_patch(patch);
>  		patch = patch->next;
>  	}
> @@ -3530,6 +3533,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)
> @@ -3539,8 +3543,8 @@ static int write_out_one_reject(struct patch *patch)
>  
>  	if (!cnt) {
>  		if (apply_verbosely)
> -			say_patch_name(stderr,
> -				       "Applied patch ", patch, " cleanly.\n");
> +			say_patch_name(stderr, patch,
> +				       _("Applied patch %s cleanly."));
>  		return 0;
>  	}
>  
> @@ -3551,8 +3555,9 @@ 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, _("Applying patch %%s with %d rejects..."), cnt);
Shouldn't this part be:
        strbuf_addf(&sb, Q_("Applying patch %%s with one reject...",
                            "Applying patch %%s with %d rejects...",
                            cnt), cnt);
?

-
Zbyszek

  reply	other threads:[~2012-04-22 16:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 12:49 [PATCH i18n 00/11] Mark more strings for translation Nguyễn Thái Ngọc Duy
2012-04-16 12:49 ` [PATCH i18n 01/11] Add three convenient format printing functions with \n automatically appended Nguyễn Thái Ngọc Duy
2012-04-16 17:26   ` Jonathan Nieder
2012-04-17  8:12   ` Erik Faye-Lund
2012-04-16 12:49 ` [PATCH i18n 02/11] i18n: mark relative dates for translation Nguyễn Thái Ngọc Duy
2012-04-16 12:49 ` [PATCH i18n 03/11] i18n: parseopt: lookup help and argument translations when showing usage Nguyễn Thái Ngọc Duy
2012-04-16 17:54   ` Jonathan Nieder
2012-04-16 23:35     ` Jonathan Nieder
2012-04-16 12:49 ` [PATCH i18n 04/11] i18n: help: mark parseopt strings for translation Nguyễn Thái Ngọc Duy
2012-04-16 12:49 ` [PATCH i18n 05/11] i18n: help: mark " Nguyễn Thái Ngọc Duy
2012-04-18 19:30   ` Jonathan Nieder
2012-04-16 12:49 ` [PATCH i18n 06/11] i18n: make warn_dangling_symref() automatically append \n Nguyễn Thái Ngọc Duy
2012-04-16 12:49 ` [PATCH i18n 07/11] i18n: remote: mark strings for translation Nguyễn Thái Ngọc Duy
2012-04-16 12:50 ` [PATCH i18n 08/11] i18n: apply: " Nguyễn Thái Ngọc Duy
2012-04-16 12:50 ` [PATCH i18n 09/11] i18n: apply: update say_patch_name to give translators complete sentence Nguyễn Thái Ngọc Duy
2012-04-22 16:42   ` Zbigniew Jędrzejewski-Szmek [this message]
2012-04-23 11:33     ` Nguyen Thai Ngoc Duy
2012-04-16 12:50 ` [PATCH i18n 10/11] i18n: index-pack: mark strings for translation Nguyễn Thái Ngọc Duy
2012-04-16 12:50 ` [PATCH i18n 11/11] i18n: bundle: " Nguyễn Thái Ngọc Duy
2012-04-18 19:40 ` [PATCH i18n 00/11] Mark more " Jonathan Nieder
2012-04-22  3:24   ` Nguyen Thai Ngoc Duy

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=4F9434F1.9000900@in.waw.pl \
    --to=zbyszek@in.waw.pl \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=worldhello.net@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).