From: Junio C Hamano <gitster@pobox.com>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: git@vger.kernel.org, Ralf Thielow <ralf.thielow@googlemail.com>
Subject: Re: [PATCH 1/2] describe: localize debug output fully
Date: Fri, 17 Mar 2017 11:17:10 -0700 [thread overview]
Message-ID: <xmqqpohf7opl.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <105f48ad2ae1aa9c88ce6088e6b304294bec0835.1489763302.git.git@drmicha.warpmail.net> (Michael J. Gruber's message of "Fri, 17 Mar 2017 16:12:32 +0100")
Michael J Gruber <git@drmicha.warpmail.net> 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@drmicha.warpmail.net>
> ---
> 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);
next prev parent reply other threads:[~2017-03-17 18:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 15:12 [PATCH 1/2] describe: localize debug output fully Michael J Gruber
2017-03-17 15:12 ` [PATCH 2/2] l10n: de: translate describe debug terms Michael J Gruber
2017-03-17 18:17 ` Junio C Hamano [this message]
2017-03-27 16:50 ` [PATCH v2 0/2] describe: localize debug output Michael J Gruber
2017-03-27 16:50 ` [PATCH v2 1/2] describe: localize debug output fully Michael J Gruber
2017-03-27 16:50 ` [PATCH v2 2/2] l10n: de: translate describe debug terms Michael J Gruber
2017-03-27 20:44 ` [PATCH v2 0/2] describe: localize debug output Junio C Hamano
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=xmqqpohf7opl.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=ralf.thielow@googlemail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.