public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Vasco Almeida <vascomalmeida@sapo•pt>
Cc: git@vger•kernel.org, "Jiang Xin" <worldhello.net@gmail•com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail•com>,
	Sunshine <sunshine@sunshineco•com>
Subject: Re: [PATCH v3 28/39] i18n: config: unfold error messages marked for translation
Date: Thu, 02 Jun 2016 10:36:18 -0700	[thread overview]
Message-ID: <xmqq7fe7v6gd.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <574FFC49.9040409@sapo.pt> (Vasco Almeida's message of "Thu, 2 Jun 2016 09:28:41 +0000")

Vasco Almeida <vascomalmeida@sapo•pt> writes:

> Às 17:43 de 01-06-2016, Junio C Hamano escreveu:
>> Vasco Almeida <vascomalmeida@sapo•pt> writes:
>> 
>>> Introduced in 473166b ("config: add 'origin_type' to config_source
>>> struct", 2016-02-19), Git can inform the user about the origin of a
>>> config error, but the implementation does not allow translators to
>>> translate the keywords 'file', 'blob, 'standard input', and
>>> 'submodule-blob'. Moreover, for the second message, a reason for the
>>> error is appended to the message, not allowing translators to translate
>>> that reason either.
>> 
>> Good intentions.
>> 
>>> @@ -417,6 +417,7 @@ static int git_parse_source(config_fn_t fn, void *data)
>>>  	int comment = 0;
>>>  	int baselen = 0;
>>>  	struct strbuf *var = &cf->var;
>>> +	char error_msg[128];
>>>  
>>>  	/* U+FEFF Byte Order Mark in UTF8 */
>>>  	const char *bomptr = utf8_bom;
>>> @@ -471,10 +472,38 @@ static int git_parse_source(config_fn_t fn, void *data)
>>>  		if (get_value(fn, data, var) < 0)
>>>  			break;
>>>  	}
>>> +
>>> +	switch (cf->origin_type) {
>>> +	case CFG_BLOB:
>>> +		xsnprintf(error_msg, sizeof(error_msg),
>>> +			  _("bad config line %d in blob %s"),
>>> +			  cf->linenr, cf->name);
>> 
>> Use xstrfmt() intead, perhaps?  That would be cleaner.
>> 
> Wouldn't that create a memory leak?

Yes, I didn't mean to suggest "use xstrfmt() instead of xsnprintf()
without changing anything else".  It was merely to suggest that you
do not have to have 128-byte limit if you used xstrfmt(); having to
free the result was too obvious that I left it unsaid, and as expected,
you noticed the need to do so, which is good ;-)

  reply	other threads:[~2016-06-02 17:36 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01 16:40 [PATCH v3 00/39] i18n and test updates Vasco Almeida
2016-06-01 16:40 ` [PATCH v3 01/39] i18n: builtin/remote.c: fix mark for translation Vasco Almeida
2016-06-01 16:40 ` [PATCH v3 02/39] i18n: advice: mark string about detached head " Vasco Almeida
2016-06-01 16:40 ` [PATCH v3 03/39] i18n: advice: internationalize message for conflicts Vasco Almeida
2016-06-01 16:40 ` [PATCH v3 04/39] i18n: transport: mark strings for translation Vasco Almeida
2016-06-01 16:40 ` [PATCH v3 05/39] i18n: sequencer: mark entire sentences " Vasco Almeida
2016-06-01 16:40 ` [PATCH v3 06/39] i18n: sequencer: mark string " Vasco Almeida
2016-06-01 16:40 ` [PATCH v3 07/39] i18n: merge-octopus: mark messages " Vasco Almeida
2016-06-01 16:40 ` [PATCH v3 08/39] merge-octupus: use die shell function from git-sh-setup.sh Vasco Almeida
2016-06-01 16:40 ` [PATCH v3 09/39] i18n: rebase: fix marked string to use eval_gettext variant Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 10/39] i18n: rebase: mark placeholder for translation Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 11/39] i18n: bisect: simplify error message for i18n Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 12/39] t6030: update to use test_i18ncmp Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 13/39] i18n: git-sh-setup.sh: mark strings for translation Vasco Almeida
2016-06-01 18:20   ` Junio C Hamano
2016-06-01 20:30     ` Junio C Hamano
2016-06-02 14:14       ` Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 14/39] i18n: rebase-interactive: " Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 15/39] i18n: rebase-interactive: mark here-doc " Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 16/39] i18n: rebase-interactive: mark comments of squash " Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 17/39] i18n: setup: mark strings " Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 18/39] tests: use test_i18n* functions to suppress false positives Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 19/39] tests: unpack-trees: update to use test_i18n* functions Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 20/39] t9003: become resilient to GETTEXT_POISON Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 21/39] t4153: fix negated test_i18ngrep call Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 22/39] t5523: use test_i18ngrep for negation Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 23/39] i18n: bisect: mark strings for translation Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 24/39] i18n: bisect: enable l10n of bisect terms in messages Vasco Almeida
2016-06-01 17:38   ` Junio C Hamano
2016-06-02  9:04     ` Vasco Almeida
2016-06-02 17:33       ` Junio C Hamano
2016-06-03 12:32         ` Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 25/39] i18n: transport-helper.c: change N_() call to _() Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 26/39] i18n: notes: mark strings for translation Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 27/39] i18n: notes: mark options " Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 28/39] i18n: config: unfold error messages marked " Vasco Almeida
2016-06-01 17:43   ` Junio C Hamano
2016-06-02  9:28     ` Vasco Almeida
2016-06-02 17:36       ` Junio C Hamano [this message]
2016-06-01 16:41 ` [PATCH v3 29/39] i18n: merge: mark messages " Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 30/39] i18n: merge: change command option help to lowercase Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 31/39] i18n: sequencer: add period to error message Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 32/39] i18n: standardise messages Vasco Almeida
2016-06-01 16:41 ` [PATCH v3 33/39] i18n: remote: mark URL fallback text for translation Vasco Almeida
2016-06-01 18:12 ` [PATCH v3 34/39] i18n: remote: allow translations to reorder message Vasco Almeida
2016-06-01 18:12 ` [PATCH v3 35/39] i18n: init-db: join message pieces Vasco Almeida
2016-06-01 18:13 ` [PATCH v3 36/39] i18n: submodule: join strings marked for translation Vasco Almeida
2016-06-01 18:13 ` [PATCH v3 37/39] i18n: submodule: escape shell variables inside eval_gettext Vasco Almeida
2016-06-01 18:13 ` [PATCH v3 38/39] i18n: unmark die messages for translation Vasco Almeida
2016-06-01 18:13 ` [PATCH v3 39/39] i18n: branch: mark comment when editing branch description " Vasco Almeida

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=xmqq7fe7v6gd.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=avarab@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=sunshine@sunshineco$(echo .)com \
    --cc=vascomalmeida@sapo$(echo .)pt \
    --cc=worldhello.net@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox