git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasco Almeida <vascomalmeida@sapo.pt>
To: Junio C Hamano <gitster@pobox.com>
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 24/39] i18n: bisect: enable l10n of bisect terms in messages
Date: Thu, 2 Jun 2016 09:04:38 +0000	[thread overview]
Message-ID: <574FF6A6.8030609@sapo.pt> (raw)
In-Reply-To: <xmqq4m9czu5u.fsf@gitster.mtv.corp.google.com>

Às 17:38 de 01-06-2016, Junio C Hamano escreveu:
> Vasco Almeida <vascomalmeida@sapo.pt> writes:
> 
>> +enum term { BAD, GOOD, OLD, NEW };
>> +static const char *term_names[] = {
>> +/* TRANSLATORS: in bisect.c source code file, the following terms are
>> +   used to describe a "bad commit", "good commit", "new revision", etc.
>> +   Please, if you can, check the source when you are not sure if a %s
>> +   would be replaced by one of the following terms. */
>> +	N_("bad"), N_("good"), N_("old"), N_("new"),  NULL
>> +};
>> +
>>  /* Remember to update object flag allocation in object.h */
>>  #define COUNTED		(1u<<16)
>>  
>> @@ -725,12 +734,12 @@ static void handle_bad_merge_base(void)
>>  	if (is_expected_rev(current_bad_oid)) {
>>  		char *bad_hex = oid_to_hex(current_bad_oid);
>>  		char *good_hex = join_sha1_array_hex(&good_revs, ' ');
>> -		if (!strcmp(term_bad, "bad") && !strcmp(term_good, "good")) {
>> +		if (!strcmp(term_bad, term_names[BAD]) && !strcmp(term_good, term_names[GOOD])) {
>>  			fprintf(stderr, _("The merge base %s is bad.\n"
>>  				"This means the bug has been fixed "
>>  				"between %s and [%s].\n"),
>>  				bad_hex, bad_hex, good_hex);
>> -		} else if (!strcmp(term_bad, "new") && !strcmp(term_good, "old")) {
>> +		} else if (!strcmp(term_bad, term_names[NEW]) && !strcmp(term_good, term_names[OLD])) {
>>  			fprintf(stderr, _("The merge base %s is new.\n"
>>  				"The property has changed "
>>  				"between %s and [%s].\n"),
>> @@ -739,7 +748,7 @@ static void handle_bad_merge_base(void)
>>  			fprintf(stderr, _("The merge base %s is %s.\n"
>>  				"This means the first '%s' commit is "
>>  				"between %s and [%s].\n"),
>> -				bad_hex, term_bad, term_good, bad_hex, good_hex);
>> +				bad_hex, _(term_bad), _(term_good), bad_hex, good_hex);
> 
> These "bad" and "good" that are compared with term_bad and term_good
> are the literal tokens the end user gives from the "git bisect"
> command line.  I do not think you would want to catch them with
> 
>     $ git bisect novo <rev>
>     $ git bisect velho <rev>
> 
> unless the user has done
> 
>     $ git bisect --term-old=velho --term-new=novo
> 
> previously.

I may be misunderstanding you, but we do not "catch" those terms with
this patch, although I'm not sure what you mean by "catch them". I think
you forget that no-operation N_("good"), does not affect in any way the
string "good", it only enables xgettext to extract it to .pot file, does
not trigger translation.
Overall, I don't understand what are you trying to tell me here.

> 
> And that "custom bisect terms" case is covered by the last "else"
> clause in this if/elseif cascade (outside the context we can see in
> your message).
> 
> The only thing you need to do around here is to mark the string as
> translatable.  I do not think we need "enum term", or term_names[].

This patch tries to make bisect output those term translated within the
also translated message. To enable this, it is handy to have
term_names[] in order to mark each term, although I could have mark them
anywhere they appeared in the source. It was only for that I chose to
have term_names[].
> 
>> @@ -747,7 +756,7 @@ static void handle_bad_merge_base(void)
>>  	fprintf(stderr, _("Some %s revs are not ancestor of the %s rev.\n"
>>  		"git bisect cannot work properly in this case.\n"
>>  		"Maybe you mistook %s and %s revs?\n"),
>> -		term_good, term_bad, term_good, term_bad);
>> +		_(term_good), _(term_bad), _(term_good), _(term_bad));
> 
> Likewise for all _(term_good), _(term_bad) and use of term_names[]
> we see in this patch.
> 

Indeed this was more of a PATCH/RFC to see what people would think of
it. If nobody contest and there is no value in it, I'll happily drop
this patch in the next re-roll.

My motivation for this patch was that a user could feel embarrassment
reading a message in her language with those terms untranslated.
Although I do believe that no translating them is also a possibility.

  reply	other threads:[~2016-06-02 14:39 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 [this message]
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
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=574FF6A6.8030609@sapo.pt \
    --to=vascomalmeida@sapo.pt \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    --cc=worldhello.net@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).