Re: [PATCH 1/2] describe: localize debug output fully

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

 



Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> writes:

> git describe --debug localizes all debug messages but not the terms
> head, lightweight, annotated that it outputs for the candidates.
> Localize them, too.
>
> Also, increase the width of that field to create room for the translated
> terms.

If you worry about something not fitting within 11, there is no
guarantee that 15 is enough.  Wouldn't it be saner to make that
_("%-11s %8d %s\n") localizable, too?

Alternatively,

	if (debug) {
		static int label_width = -1;
		if (label_width < 0) {
			int i;
			for (i = 0; i < ARRAY_SIZE(prio_names); i++)
				... do a one-time width measurement
                                ... to set label_width
		}
		fprintf(stderr, "%-.*s %8d %s\n", 
		                label_width, _(prio_names[t->name->prio]),
				...);
	...

or something like that, perhaps?

> Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
> ---
> Ralf: this is just the context for the following l10-de patch
>
>  builtin/describe.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/describe.c b/builtin/describe.c
> index 76c18059bf..1a760c16f9 100644
> --- a/builtin/describe.c
> +++ b/builtin/describe.c
> @@ -49,7 +49,7 @@ struct commit_name {
>  };
>  
>  static const char *prio_names[] = {
> -	"head", "lightweight", "annotated",
> +	N_("head"), N_("lightweight"), N_("annotated"),
>  };
>  
>  static int commit_name_cmp(const struct commit_name *cn1,
> @@ -396,8 +396,8 @@ static void describe(const char *arg, int last_one)
>  	if (debug) {
>  		for (cur_match = 0; cur_match < match_cnt; cur_match++) {
>  			struct possible_tag *t = &all_matches[cur_match];
> -			fprintf(stderr, " %-11s %8d %s\n",
> -				prio_names[t->name->prio],
> +			fprintf(stderr, " %-15s %8d %s\n",
> +				_(prio_names[t->name->prio]),
>  				t->depth, t->name->path);
>  		}
>  		fprintf(stderr, _("traversed %lu commits\n"), seen_commits);



[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]