git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH/RESEND] transport.c: mark push status strings for translation
Date: Tue, 3 Dec 2013 12:08:57 -0800	[thread overview]
Message-ID: <20131203200857.GE29959@google.com> (raw)
In-Reply-To: <1386066409-15262-1-git-send-email-pclouds@gmail.com>

Nguyễn Thái Ngọc Duy wrote:

> Mark strings like "[up to date]" passed to print_ref_status() for
> translation with N_() instead of _() so they can remain untranslated
> in porcelain mode.

Makes sense.

[...]
> --- a/builtin/push.c
> +++ b/builtin/push.c

Perhaps it would make sense to send these as a separate patch, since
they are simpler than the rest.

[...]
> --- a/transport.c
> +++ b/transport.c
> @@ -14,6 +14,7 @@
>  #include "url.h"
>  #include "submodule.h"
>  #include "string-list.h"
> +#include "utf8.h"
>  
>  /* rsync support */
>  
> @@ -627,16 +628,23 @@ static void print_ref_status(char flag, const char *summary, struct ref *to, str
>  		else
>  			fprintf(stdout, "%s\n", summary);
>  	} else {
> -		fprintf(stderr, " %c %-*s ", flag, TRANSPORT_SUMMARY_WIDTH, summary);
> +		int width = TRANSPORT_SUMMARY_WIDTH;
> +		const char *localized_summary = _(summary);

The summary arg comes from one of a few places:

 (a) [deleted] etc from print_ok_ref_status, which you marked
     with N_ (good)

 (b) deadbe... from status_abbrev via print_ok_ref_status.  Can we
     avoid passing it to gettext()?

 (c) [no match] etc from print_one_push_status, marked with
     N_ (good)

I am tempted to suggest something like

		const char *localized_summary;

		if (*summary != '[')
			/* Leave abbreviated sha1 from status_abbrev() alone */
			localized_summary = summary;
		else
			localized_summary = _(summary);

but that's kind of ugly.  Is there a simpler way?  Should the summary
arg be passed in already localized (with 'porcelain' handling higher
up)?

Thanks,
Jonathan

      reply	other threads:[~2013-12-03 20:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 10:26 [PATCH/RESEND] transport.c: mark push status strings for translation Nguyễn Thái Ngọc Duy
2013-12-03 20:08 ` Jonathan Nieder [this message]

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=20131203200857.GE29959@google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@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).