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

[PATCH 03/22] builtin/config.c: mark more strings for translation

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jun 2, 2018, 04:32 UTC
Message-ID
<20180602043241.9941-4-pclouds@gmail.com>
In-Reply-To
<20180602043241.9941-1-pclouds@gmail.com>
There are also some minor adjustments in the strings.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/config.c      | 48 +++++++++++++++++++++----------------------
 t/t1308-config-set.sh |  2 +-
 2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index b29d26dede..85f043a243 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -110,7 +110,7 @@ static int option_parse_type(const struct option *opt, const char *arg,
 		 * --int' and '--type=bool
 		 * --type=int'.
 		 */
-		error("only one type at a time.");
+		error(_("only one type at a time"));
 		usage_with_options(builtin_config_usage,
 			builtin_config_options);
 	}
@@ -160,7 +160,7 @@ static struct option builtin_config_options[] = {
 static void check_argc(int argc, int min, int max) {
 	if (argc >= min && argc <= max)
 		return;
-	error("wrong number of arguments");
+	error(_("wrong number of arguments"));
 	usage_with_options(builtin_config_usage, builtin_config_options);
 }
 
@@ -293,7 +293,7 @@ static int get_value(const char *key_, const char *regex_)
 
 		key_regexp = (regex_t*)xmalloc(sizeof(regex_t));
 		if (regcomp(key_regexp, key, REG_EXTENDED)) {
-			error("invalid key pattern: %s", key_);
+			error(_("invalid key pattern: %s"), key_);
 			FREE_AND_NULL(key_regexp);
 			ret = CONFIG_INVALID_PATTERN;
 			goto free_strings;
@@ -313,7 +313,7 @@ static int get_value(const char *key_, const char *regex_)
 
 		regexp = (regex_t*)xmalloc(sizeof(regex_t));
 		if (regcomp(regexp, regex_, REG_EXTENDED)) {
-			error("invalid pattern: %s", regex_);
+			error(_("invalid pattern: %s"), regex_);
 			FREE_AND_NULL(regexp);
 			ret = CONFIG_INVALID_PATTERN;
 			goto free_strings;
@@ -386,7 +386,7 @@ static char *normalize_value(const char *key, const char *value)
 	if (type == TYPE_COLOR) {
 		char v[COLOR_MAXLEN];
 		if (git_config_color(v, key, value))
-			die("cannot parse color '%s'", value);
+			die(_("cannot parse color '%s'"), value);
 
 		/*
 		 * The contents of `v` now contain an ANSI escape
@@ -481,13 +481,13 @@ static int get_colorbool(const char *var, int print)
 static void check_write(void)
 {
 	if (!given_config_source.file && !startup_info->have_repository)
-		die("not in a git directory");
+		die(_("not in a git directory"));
 
 	if (given_config_source.use_stdin)
-		die("writing to stdin is not supported");
+		die(_("writing to stdin is not supported"));
 
 	if (given_config_source.blob)
-		die("writing config blobs is not supported");
+		die(_("writing config blobs is not supported"));
 }
 
 struct urlmatch_current_candidate_value {
@@ -595,7 +595,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 
 	if (use_global_config + use_system_config + use_local_config +
 	    !!given_config_source.file + !!given_config_source.blob > 1) {
-		error("only one config file at a time.");
+		error(_("only one config file at a time"));
 		usage_with_options(builtin_config_usage, builtin_config_options);
 	}
 
@@ -622,7 +622,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"));
 
 		if (access_or_warn(user_config, R_OK, 0) &&
 		    xdg_config && !access_or_warn(xdg_config, R_OK, 0)) {
@@ -659,12 +659,12 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 	}
 
 	if ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && type) {
-		error("--get-color and variable type are incoherent");
+		error(_("--get-color and variable type are incoherent"));
 		usage_with_options(builtin_config_usage, builtin_config_options);
 	}
 
 	if (HAS_MULTI_BITS(actions)) {
-		error("only one action at a time.");
+		error(_("only one action at a time"));
 		usage_with_options(builtin_config_usage, builtin_config_options);
 	}
 	if (actions == 0)
@@ -677,19 +677,19 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 		}
 	if (omit_values &&
 	    !(actions == ACTION_LIST || actions == ACTION_GET_REGEXP)) {
-		error("--name-only is only applicable to --list or --get-regexp");
+		error(_("--name-only is only applicable to --list or --get-regexp"));
 		usage_with_options(builtin_config_usage, builtin_config_options);
 	}
 
 	if (show_origin && !(actions &
 		(ACTION_GET|ACTION_GET_ALL|ACTION_GET_REGEXP|ACTION_LIST))) {
-		error("--show-origin is only applicable to --get, --get-all, "
-			  "--get-regexp, and --list.");
+		error(_("--show-origin is only applicable to --get, --get-all, "
+			"--get-regexp, and --list"));
 		usage_with_options(builtin_config_usage, builtin_config_options);
 	}
 
 	if (default_value && !(actions & ACTION_GET)) {
-		error("--default is only applicable to --get");
+		error(_("--default is only applicable to --get"));
 		usage_with_options(builtin_config_usage,
 			builtin_config_options);
 	}
@@ -703,10 +703,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 					&given_config_source,
 					&config_options) < 0) {
 			if (given_config_source.file)
-				die_errno("unable to read config file '%s'",
+				die_errno(_("unable to read config file '%s'"),
 					  given_config_source.file);
 			else
-				die("error processing config file(s)");
+				die(_("error processing config file(s)"));
 		}
 	}
 	else if (actions == ACTION_EDIT) {
@@ -714,11 +714,11 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 
 		check_argc(argc, 0, 0);
 		if (!given_config_source.file && nongit)
-			die("not in a git directory");
+			die(_("not in a git directory"));
 		if (given_config_source.use_stdin)
-			die("editing stdin is not supported");
+			die(_("editing stdin is not supported"));
 		if (given_config_source.blob)
-			die("editing blobs is not supported");
+			die(_("editing blobs is not supported"));
 		git_config(git_default_config, NULL);
 		config_file = given_config_source.file ?
 				xstrdup(given_config_source.file) :
@@ -746,7 +746,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 		ret = git_config_set_in_file_gently(given_config_source.file, argv[0], value);
 		if (ret == CONFIG_NOTHING_SET)
 			error(_("cannot overwrite multiple values with a single value\n"
-			"       Use a regexp, --add or --replace-all to change %s."), argv[0]);
+			"       Use a regexp, --add or --replace-all to change %s"), argv[0]);
 		return ret;
 	}
 	else if (actions == ACTION_SET_ALL) {
@@ -819,7 +819,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!"));
 	}
 	else if (actions == ACTION_REMOVE_SECTION) {
 		int ret;
@@ -830,7 +830,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!"));
 	}
 	else if (actions == ACTION_GET_COLOR) {
 		check_argc(argc, 1, 2);
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index 3e00d1af01..d0a2727b85 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -233,7 +233,7 @@ test_expect_success 'check line errors for malformed values' '
 
 test_expect_success 'error on modifying repo config without repo' '
 	nongit test_must_fail git config a.b c 2>err &&
-	grep "not in a git directory" err
+	test_i18ngrep "not in a git directory" err
 '
 
 cmdline_config="'foo.bar=from-cmdline'"
-- 
2.18.0.rc0.309.g77c7720784
Previous: brian m. carlsonNext: Eric Sunshine
Message 6 of 64 in “Mark more strings for translation”
  1. 00/22 Mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  2. 01/22 archive-tar.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  3. 02/22 archive-zip.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  4. Duy NguyenJun 2, 2018
  5. brian m. carlsonJun 3, 2018
  6. 03/22 builtin/config.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  7. Eric SunshineJun 3, 2018
  8. Duy NguyenJun 3, 2018
  9. 05/22 builtin/pack-objects.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  10. 04/22 builtin/grep.c: mark strings for translation and no full stopsNguyễn Thái Ngọc Duy, Jun 2, 2018
  11. 09/22 connect.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  12. Eric SunshineJun 3, 2018
  13. 08/22 config.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  14. Eric SunshineJun 3, 2018
  15. 07/22 commit-graph.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  16. 14/22 object.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  17. 13/22 exec-cmd.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  18. 12/22 environment.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  19. 11/22 dir.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  20. Eric SunshineJun 3, 2018
  21. 10/22 convert.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  22. Eric SunshineJun 3, 2018
  23. 06/22 builtin/replace.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  24. Eric SunshineJun 3, 2018
  25. 22/22 transport-helper.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  26. Eric SunshineJun 3, 2018
  27. 21/22 transport.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  28. Eric SunshineJun 3, 2018
  29. Duy NguyenJun 3, 2018
  30. 20/22 sha1-file.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  31. Eric SunshineJun 3, 2018
  32. 19/22 sequencer.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  33. Eric SunshineJun 3, 2018
  34. Duy NguyenJun 3, 2018
  35. Eric SunshineJun 3, 2018
  36. 18/22 replace-object.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  37. 17/22 refspec.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  38. 16/22 refs.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  39. Eric SunshineJun 3, 2018
  40. 15/22 pkt-line.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 2, 2018
  41. 00/23 Mark strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  42. 01/23 Update messages in preparation for i18nNguyễn Thái Ngọc Duy, Jun 3, 2018
  43. 04/23 builtin/config.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  44. 11/23 convert.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  45. 14/23 exec-cmd.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  46. 12/23 dir.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  47. 20/23 sequencer.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  48. 21/23 sha1-file.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  49. 18/23 refspec.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  50. 22/23 transport.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  51. 19/23 replace-object.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  52. 23/23 transport-helper.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  53. 13/23 environment.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  54. 17/23 refs.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  55. 03/23 archive-zip.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  56. 15/23 object.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  57. 10/23 connect.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  58. 16/23 pkt-line.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  59. 02/23 archive-tar.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  60. 09/23 config.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  61. 05/23 builtin/grep.c: mark strings for translation and no full stopsNguyễn Thái Ngọc Duy, Jun 3, 2018
  62. 07/23 builtin/replace.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  63. 08/23 commit-graph.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 2018
  64. 06/23 builtin/pack-objects.c: mark more strings for translationNguyễn Thái Ngọc Duy, Jun 3, 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.