All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasco Almeida <vascomalmeida@sapo.pt>
To: Junio C Hamano <gitster@pobox.com>
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: Thu, 28 Jul 2016 10:38:22 +0000	[thread overview]
Message-ID: <1469702302.1884.8.camel@sapo.pt> (raw)
In-Reply-To: <xmqqy44mvol9.fsf@gitster.mtv.corp.google.com>

A Qua, 27-07-2016 às 13:00 -0700, Junio C Hamano escreveu:
> 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.

Probably that is why I have omitted cf->name for CONFIG_ORIGIN_STDIN
instance first time I sent this patch [1]. This patch was dropped from
previous i18n batch because it conflicted with other changes in flux.
Forgot about that and, for no good reason, added cf->name.
Thank you for pointing out.

[1] http://www.mail-archive.com/git%40vger.kernel.org/msg96368.html

  reply	other threads:[~2016-07-28 10:38 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
2016-07-28 10:38   ` Vasco Almeida [this message]
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=1469702302.1884.8.camel@sapo.pt \
    --to=vascomalmeida@sapo.pt \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=larsxschneider@gmail.com \
    --cc=peff@peff.net \
    --cc=ramsay@ramsayjones.plus.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.