From: Junio C Hamano <gitster@pobox.com>
To: Vasco Almeida <vascomalmeida@sapo.pt>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Ramsay Jones <ramsay@ramsayjones.plus.com>,
Lars Schneider <larsxschneider@gmail.com>
Subject: Re: [PATCH] i18n: config: unfold error messages marked for translation
Date: Wed, 27 Jul 2016 13:00:02 -0700 [thread overview]
Message-ID: <xmqqy44mvol9.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1469642375-27305-1-git-send-email-vascomalmeida@sapo.pt> (Vasco Almeida's message of "Wed, 27 Jul 2016 17:59:35 +0000")
Vasco Almeida <vascomalmeida@sapo.pt> writes:
> +
> + switch (cf->origin_type) {
> + case CONFIG_ORIGIN_BLOB:
> + error_msg = xstrfmt(_("bad config line %d in blob %s"),
> + cf->linenr, cf->name);
> + break;
> + case CONFIG_ORIGIN_FILE:
> + error_msg = xstrfmt(_("bad config line %d in file %s"),
> + cf->linenr, cf->name);
> + break;
Hmm, if we were to switch the message based on the origin type, then
things like this:
> + case CONFIG_ORIGIN_STDIN:
> + error_msg = xstrfmt(_("bad config line %d in standard input %s"),
> + cf->linenr, cf->name);
> + break;
and this:
> + case CONFIG_ORIGIN_STDIN:
> + die(errno == ERANGE
> + ? _("bad numeric config value '%s' for '%s' in standard input %s: out of range")
> + : _("bad numeric config value '%s' for '%s' in standard input %s: invalid unit"),
> + value, name, cf->name);
that does not have any useful cf->name can be improved even more, no?
The only reason why we pass an empty string here:
> static int git_config_from_stdin(config_fn_t fn, void *data)
> {
> - return do_config_from_file(fn, "standard input", "", NULL, stdin, data);
> + return do_config_from_file(fn, CONFIG_ORIGIN_STDIN, "", NULL, stdin, data);
> }
is because do_config_from_file() function whose primary purpose is
to read from file was reused, the interface to that function
requires the filename there for reporting, and we do not have
anything useful when reading from the standard input.
next prev parent reply other threads:[~2016-07-27 20:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 17:59 [PATCH] i18n: config: unfold error messages marked for translation Vasco Almeida
2016-07-27 20:00 ` Junio C Hamano [this message]
2016-07-28 10:38 ` Vasco Almeida
2016-07-27 22:41 ` Junio C Hamano
2016-07-28 13:14 ` [PATCH v2] " Vasco Almeida
2016-07-28 16:12 ` Junio C Hamano
2016-07-28 16:17 ` Jeff King
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=xmqqy44mvol9.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=larsxschneider@gmail.com \
--cc=peff@peff.net \
--cc=ramsay@ramsayjones.plus.com \
--cc=vascomalmeida@sapo.pt \
/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.