git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 01/23] Update messages in preparation for i18n

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 19, 2018, 18:18 UTC
Message-ID
<xmqqr2jzf5rk.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180718161101.19765-2-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 11 quoted lines
>  static void check_argc(int argc, int min, int max) {
>  	if (argc >= min && argc <= max)
>  		return;
> -	error("wrong number of arguments");
> +	if (min == max)
> +		error("wrong number of arguments, should be %d", min);
> +	else
> +		error("wrong number of arguments, should be from %d to %d",
> +		      min, max);
>  	usage_with_options(builtin_config_usage, builtin_config_options);
>  }
Good. This was the only instance of
> - some messages are improved to give more information
I spotted.
Show 6 quoted lines
> @@ -622,7 +626,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
>  			 * location; error out even if XDG_CONFIG_HOME
>  			 * is set and points at a sane location.
>  			 */
> -			die("$HOME not set");
> +			die("$HOME is not set");

Meh. There are many verb-less messages e.g. "only one X at a time" that are not given a new verb in this patch.

Show 16 quoted lines
> @@ -819,7 +823,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
>  		if (ret < 0)
>  			return ret;
>  		if (ret == 0)
> -			die("No such section!");
> +			die("no such section: %s", argv[0]);
>  	}
>  	else if (actions == ACTION_REMOVE_SECTION) {
>  		int ret;
> @@ -830,7 +834,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
>  		if (ret < 0)
>  			return ret;
>  		if (ret == 0)
> -			die("No such section!");
> +			die("no such section: %s", argv[0]);
>  	}

There are check_argc() calls before these two hunks to ensure that access to argv[0] is safe, so these are good.

Show 6 quoted lines
> @@ -2638,7 +2638,7 @@ static void read_object_list_from_stdin(void)
>  			if (feof(stdin))
>  				break;
>  			if (!ferror(stdin))
> -				die("fgets returned NULL, not EOF, not error!");
> +				die("BUG: fgets returned NULL, not EOF, not error!");
This is not BUG("...") because it is not *our* bug but a bug in platform's stdio?
Show 12 quoted lines
> @@ -456,10 +456,10 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
>  		return -1;
>  	}
>  
> -	if (remove_signature(&buf)) {
> -		warning(_("the original commit '%s' has a gpg signature."), old_ref);
> -		warning(_("the signature will be removed in the replacement commit!"));
> -	}
> +	if (remove_signature(&buf))
> +		warning(_("the original commit '%s' has a gpg signature.\n"
> +			  "The signature will be removed in the replacement commit!"),
> +			old_ref);

Unlike a compound sentence, for which translators may appreciate that they can reorder the parts of it to suit their language, I do not see why these two independent sentences should be placed in a single warning().

Or is this primarily about avoiding repeated appearance of "warning:" labels, i.e.

	warning: sentence one
	warning: sentence two

I am not sure if these belong to this "simple mechanical conversion or otherwise uncontrovercial improvement" series.

Show 13 quoted lines
> diff --git a/config.c b/config.c
> index f4a208a166..6ba07989f1 100644
> --- a/config.c
> +++ b/config.c
> @@ -461,7 +461,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
>  	envw = xstrdup(env);
>  
>  	if (sq_dequote_to_argv(envw, &argv, &nr, &alloc) < 0) {
> -		ret = error("bogus format in " CONFIG_DATA_ENVIRONMENT);
> +		ret = error("bogus format in %s", CONFIG_DATA_ENVIRONMENT);
>  		goto out;
>  	}
>  

Good job spotting that the original wanted to say, but failed to say, that CONFIG_DATA_ENVIRONMENT as the source of broken data we detected. But I am not sure CONFIG_DATA_ENVIRONMENT is what we want to report as the source of bad data to the end users. One-shot configuration we get form "git -c VAR=VAL" are placed in the environment as an internal implementation detail, so from their point of view, the place we saw broken data coming from is their command line "git -c VAR=VAL" one-shot configuration.

Show 14 quoted lines
> @@ -1409,11 +1409,11 @@ static int git_default_push_config(const char *var, const char *value)
>  			push_default = PUSH_DEFAULT_UPSTREAM;
>  		else if (!strcmp(value, "current"))
>  			push_default = PUSH_DEFAULT_CURRENT;
> -		else {
> -			error("malformed value for %s: %s", var, value);
> -			return error("Must be one of nothing, matching, simple, "
> -				     "upstream or current.");
> -		}
> +		else
> +			return error("malformed value for %s: %s\n"
> +				     "Must be one of nothing, matching, simple, "
> +				     "upstream or current.",
> +				     var, value);
The same comment as an earlier warning().
Show 6 quoted lines
> -	if (flags & CONNECT_VERBOSE)
> -		fprintf(stderr, "done.\nConnecting to %s (port %s) ... ", host, port);
> +	if (flags & CONNECT_VERBOSE) {
> +		fprintf_ln(stderr, "done.");
> +		fprintf(stderr, "Connecting to %s (port %s) ... ", host, port);
> +	}

It was not immediately obvious why this is a good change, but with this patch, we have many instances of "done." that can share the same translation, I guess.

> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
> diff --git a/t/t3005-ls-files-relative.sh b/t/t3005-ls-files-relative.sh
> diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
> diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh

It is surprising that the fallout from the conversions in the rest of the patch is this small ;-)

Whew. This was a rather sizeable patch. The parts I did not quote and comment all looked good.

Thanks.
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 10 of 58 in “Mark strings for translation”
  1. 00/23 Mark strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  2. 02/23 archive-tar.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  3. Junio C HamanoJul 19, 2018
  4. Duy NguyenJul 21, 2018
  5. 03/23 archive-zip.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  6. Junio C HamanoJul 19, 2018
  7. Duy NguyenJul 19, 2018
  8. Junio C HamanoJul 19, 2018
  9. 01/23 Update messages in preparation for i18nNguyễn Thái Ngọc Duy, Jul 18, 2018
  10. Junio C HamanoJul 19, 2018
  11. Junio C HamanoJul 19, 2018
  12. Duy NguyenJul 21, 2018
  13. 04/23 builtin/config.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  14. 05/23 builtin/grep.c: mark strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  15. 06/23 builtin/pack-objects.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  16. Junio C HamanoJul 19, 2018
  17. 08/23 commit-graph.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  18. 07/23 builtin/replace.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  19. 09/23 config.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  20. 10/23 connect.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  21. Junio C HamanoJul 19, 2018
  22. 11/23 convert.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  23. 13/23 environment.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  24. 12/23 dir.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  25. 14/23 exec-cmd.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  26. 15/23 object.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  27. 16/23 pkt-line.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  28. 17/23 refs.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  29. 18/23 refspec.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  30. 19/23 replace-object.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  31. 20/23 sequencer.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  32. 21/23 sha1-file.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  33. 22/23 transport.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  34. 23/23 transport-helper.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 18, 2018
  35. 00/23 Mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  36. 01/23 Update messages in preparation for i18nNguyễn Thái Ngọc Duy, Jul 21, 2018
  37. 05/23 builtin/grep.c: mark strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  38. 03/23 archive-zip.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  39. 04/23 builtin/config.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  40. 06/23 builtin/pack-objects.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  41. 08/23 commit-graph.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  42. 07/23 builtin/replace.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  43. 10/23 connect.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  44. 12/23 dir.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  45. 13/23 environment.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  46. 15/23 object.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  47. 14/23 exec-cmd.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  48. 11/23 convert.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  49. 16/23 pkt-line.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  50. 18/23 refspec.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  51. 19/23 replace-object.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  52. 20/23 sequencer.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  53. 17/23 refs.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  54. 21/23 sha1-file.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  55. 22/23 transport.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  56. 23/23 transport-helper.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  57. 09/23 config.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018
  58. 02/23 archive-tar.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jul 21, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.