Re: [PATCH/RESEND] transport.c: mark push status strings for translation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]