From: Jonathan Nieder Date: Tue, 03 Dec 2013 20:08:57 GMT Subject: Re: [PATCH/RESEND] transport.c: mark push status strings for translation Message-ID: <20131203200857.GE29959@google.com> 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