threads / discuss / 38634

Internationalization and yes/no prompts

Subject: Internationalization and yes/no prompts

## tl;dr

9 messages between Feb 23, 2015 and Mar 2, 2015.

replies: 8people: 4as markdown or json

Pierre-Olivier Vares· Feb 23, 2015, 15:46 UTC · lore
Hi,
I just fell in a little trap, in which you may find interest.

I'm using git on the command line (on an Elementary OS system : Linux 3.2.0-76-generic #111-Ubuntu SMP Tue Jan 13 22:16:09 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux). git version : 2.3.0

My system is configured in french.
That's said :
I run a git clean -i, and select option 4 (ask each).
     (By the fact, messages are translated, but options of the 
'interactive' menu aren't)
So I get, for each file, the question :
/Supprimer //premier_fichier ? [Remove first_file ?]/
Natural answer to this question is 'Oui' [Yes], so I type 'o', rather 
than 'y'.
Once finished, I see no file has been removed (since 'o' has been 
considered as 'different than yes')
Whereas it's not an end-of-the-world thing*, it's annoying as at first 
sight I didn't understand why it has 'not worked'.
I thought of a few possibilities (some easy to implement, others more 
complex; some are stricter for the user) :
- explicitly put "y/n" in the message. Translaters should be warned to 
let "y/n",
- only allow y and n answers (and variants : yes, no), and reject 
everything else with a message
- use as 'n', but echoes a message : 'Answer considered as /no/'
- accept answers depending on the language used to echo the prompt (y/n 
for english, o/n for french, j/n for german, ...)
What do you think about that ?
* but just imagine how worst it could be if you're configured in a 
language where 'No' is said using a word beginning by 'Y'...

Cheers, Pierre-Olivier Vares

Junio C Hamano· Feb 24, 2015, 20:32 UTC · re: Pierre-Olivier Vares · lore

Re: Internationalization and yes/no prompts

Pierre-Olivier Vares <pierre-olivier.vares@fingerprint.fr> writes:
Show 10 quoted lines
> /Supprimer //premier_fichier ? [Remove first_file ?]/
> Natural answer to this question is 'Oui' [Yes], so I type 'o', rather
> than 'y'.
> Once finished, I see no file has been removed (since 'o' has been
> considered as 'different than yes')
> Whereas it's not an end-of-the-world thing*, it's annoying as at first
> sight I didn't understand why it has 'not worked'.
>
> I thought of a few possibilities (some easy to implement, others more
> complex; some are stricter for the user) :
> - explicitly put "y/n" in the message. Translaters should be warned to
> let "y/n",

This may be suboptimal from the end-user's point of view, but it is the least risky of breaking anything.

And it is way better than the status quo.
> - only allow y and n answers (and variants : yes, no), and reject
> everything else with a message

This is not helpful to the users if it does not say why (O)ui was rejected, which would mean we would be better off saying [Y/n] in the message in the first place.

> - use as 'n', but echoes a message : 'Answer considered as /no/'

Unhelpful without stating why (O)ui was considered as 'no'; same conclusion as above.

> - accept answers depending on the language used to echo the prompt
> (y/n for english, o/n for french, j/n for german, ...)

This would be the best for languages where translations for Yes and No begin with different letters, but I suspect it might be tricky to implement.

Jean-Noël Avila· Feb 25, 2015, 09:42 UTC · re: Junio C Hamano · lore

Re: Internationalization and yes/no prompts

Le 24/02/2015 21:32, Junio C Hamano a écrit :
Show 8 quoted lines
>> - explicitly put "y/n" in the message. Translaters should be warned to
>> let "y/n",
> This may be suboptimal from the end-user's point of view, but it is
> the least risky of breaking anything.
>
> And it is way better than the status quo.
>
>
I can push a small update for this one.
The "yes" string could be translated in builtin/clean.c

Are there other places where a translated part asks explicitly for a yes/no reply? It is not clear from the content of the po file.

BR
Jean-Noël
Jean-Noel Avila· Feb 28, 2015, 15:39 UTC · re: Junio C Hamano · lore

[PATCH] Add hint for translators for y/n reply.

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
---
 builtin/clean.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/builtin/clean.c b/builtin/clean.c
index 7e7fdcf..2c98661 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -754,6 +754,9 @@ static int ask_each_cmd(void)
 		/* Ctrl-D should stop removing files */
 		if (!eof) {
 			qname = quote_path_relative(item->string, NULL, &buf);
+			/*TRANSLATORS: Make sure to include [Y] and [n] in your
+			translation. The program will only accept English input
+			at this point. */
 			printf(_("remove %s? "), qname);
 			if (strbuf_getline(&confirm, stdin, '\n') != EOF) {
 				strbuf_trim(&confirm);
-- 
2.3.0
Jiang Xin· Mar 1, 2015, 00:18 UTC · re: Jean-Noel Avila · lore

Re: [PATCH] Add hint for translators for y/n reply.

2015-02-28 23:39 GMT+08:00 Jean-Noel Avila <jn.avila@free.fr>:
Show 17 quoted lines
> Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
> ---
>  builtin/clean.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/builtin/clean.c b/builtin/clean.c
> index 7e7fdcf..2c98661 100644
> --- a/builtin/clean.c
> +++ b/builtin/clean.c
> @@ -754,6 +754,9 @@ static int ask_each_cmd(void)
>                 /* Ctrl-D should stop removing files */
>                 if (!eof) {
>                         qname = quote_path_relative(item->string, NULL, &buf);
> +                       /*TRANSLATORS: Make sure to include [Y] and [n] in your
> +                       translation. The program will only accept English input
> +                       at this point. */
>                         printf(_("remove %s? "), qname);

Yes, it may confuse. In order to let the translators notice this and update, you'd better change the code like this:

        printf(_("remove %s [y/N]? "), qname);
-- 
Jiang Xin
Jiang Xin· Mar 1, 2015, 00:30 UTC · re: Jiang Xin · lore

Re: [PATCH] Add hint for translators for y/n reply.

2015-03-01 8:18 GMT+08:00 Jiang Xin <worldhello.net@gmail.com>:
Show 24 quoted lines
> 2015-02-28 23:39 GMT+08:00 Jean-Noel Avila <jn.avila@free.fr>:
>> Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
>> ---
>>  builtin/clean.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/builtin/clean.c b/builtin/clean.c
>> index 7e7fdcf..2c98661 100644
>> --- a/builtin/clean.c
>> +++ b/builtin/clean.c
>> @@ -754,6 +754,9 @@ static int ask_each_cmd(void)
>>                 /* Ctrl-D should stop removing files */
>>                 if (!eof) {
>>                         qname = quote_path_relative(item->string, NULL, &buf);
>> +                       /*TRANSLATORS: Make sure to include [Y] and [n] in your
>> +                       translation. The program will only accept English input
>> +                       at this point. */
>>                         printf(_("remove %s? "), qname);
>
> Yes, it may confuse.  In order to let the translators notice this and update,
> you'd better change the code like this:
>
>         printf(_("remove %s [y/N]? "), qname);
>

What's more, you should capitalize the leading character letter of the word remove. My English.

>
> --
> Jiang Xin
Junio C Hamano· Mar 1, 2015, 04:02 UTC · re: Jiang Xin · lore

Re: [PATCH] Add hint for translators for y/n reply.

Jiang Xin <worldhello.net@gmail.com> writes:
Show 17 quoted lines
> 2015-02-28 23:39 GMT+08:00 Jean-Noel Avila <jn.avila@free.fr>:
>> Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
>> ---
>>  builtin/clean.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/builtin/clean.c b/builtin/clean.c
>> index 7e7fdcf..2c98661 100644
>> --- a/builtin/clean.c
>> +++ b/builtin/clean.c
>> @@ -754,6 +754,9 @@ static int ask_each_cmd(void)
>>                 /* Ctrl-D should stop removing files */
>>                 if (!eof) {
>>                         qname = quote_path_relative(item->string, NULL, &buf);
>> +                       /*TRANSLATORS: Make sure to include [Y] and [n] in your
>> +                       translation. The program will only accept English input
>> +                       at this point. */

A comment "We will accept only y, Y, Ye, YE,... as 'affirmative'" in the code to translators will not help the end users at all, so make it a single liner like this:

	/* TRANSLATORS: make sure to keep [y/N] as-is */
Make sure you have SP after slash-asterisk.
Show 6 quoted lines
>>                         printf(_("remove %s? "), qname);
>
> Yes, it may confuse.  In order to let the translators notice this and update,
> you'd better change the code like this:
>
>         printf(_("remove %s [y/N]? "), qname);

A very good suggestion. The code that follows this part treats an empty input and a random non-empty input that does not head-match "yes" as "please do not remove"; upcasing N is a good visual hint that that "no" is the default.

Thanks.
Jean-Noel Avila· Mar 1, 2015, 11:58 UTC · re: Jean-Noel Avila · lore

[PATCHv2] Add hint interactive cleaning

For translators, specify that a  y/N reply is needed.
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
---
 builtin/clean.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/clean.c b/builtin/clean.c
index 7e7fdcf..98c103f 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -754,7 +754,8 @@ static int ask_each_cmd(void)
 		/* Ctrl-D should stop removing files */
 		if (!eof) {
 			qname = quote_path_relative(item->string, NULL, &buf);
-			printf(_("remove %s? "), qname);
+			/* TRANSLATORS: Make sure to keep [y/N] as is */
+			printf(_("Remove %s [y/N]? "), qname);
 			if (strbuf_getline(&confirm, stdin, '\n') != EOF) {
 				strbuf_trim(&confirm);
 			} else {
-- 
2.3.0
Junio C Hamano· Mar 2, 2015, 19:39 UTC · re: Jean-Noel Avila · lore

Re: [PATCHv2] Add hint interactive cleaning

Jean-Noel Avila <jn.avila@free.fr> writes:
Show 21 quoted lines
> For translators, specify that a  y/N reply is needed.
>
> Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
> ---
>  builtin/clean.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/clean.c b/builtin/clean.c
> index 7e7fdcf..98c103f 100644
> --- a/builtin/clean.c
> +++ b/builtin/clean.c
> @@ -754,7 +754,8 @@ static int ask_each_cmd(void)
>  		/* Ctrl-D should stop removing files */
>  		if (!eof) {
>  			qname = quote_path_relative(item->string, NULL, &buf);
> -			printf(_("remove %s? "), qname);
> +			/* TRANSLATORS: Make sure to keep [y/N] as is */
> +			printf(_("Remove %s [y/N]? "), qname);
>  			if (strbuf_getline(&confirm, stdin, '\n') != EOF) {
>  				strbuf_trim(&confirm);
>  			} else {

Thanks. All other interactive prompts from this command (i.e. menu_opts.prompt) seem to capitalize their first word, so upcasing this message is a good change, too.

← back to recent threads