git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: pclouds@gmail.com
Cc: git@vger.kernel.org, gitster@pobox.com, newren@gmail.com,
	stolee@gmail.com
Subject: [PATCH v3 04/23] builtin/config.c: mark more strings for translation
Date: Sat, 21 Jul 2018 09:49:22 +0200	[thread overview]
Message-ID: <20180721074941.14632-5-pclouds@gmail.com> (raw)
In-Reply-To: <20180721074941.14632-1-pclouds@gmail.com>

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 a09ead5bc8..5761a2c4ac 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);
 	}
@@ -161,9 +161,9 @@ static void check_argc(int argc, int min, int max) {
 	if (argc >= min && argc <= max)
 		return;
 	if (min == max)
-		error("wrong number of arguments, should be %d", min);
+		error(_("wrong number of arguments, should be %d"), min);
 	else
-		error("wrong number of arguments, should be from %d to %d",
+		error(_("wrong number of arguments, should be from %d to %d"),
 		      min, max);
 	usage_with_options(builtin_config_usage, builtin_config_options);
 }
@@ -297,7 +297,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;
@@ -317,7 +317,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;
@@ -390,7 +390,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
@@ -485,13 +485,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 {
@@ -599,7 +599,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);
 	}
 
@@ -626,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 not set"));
 
 		if (access_or_warn(user_config, R_OK, 0) &&
 		    xdg_config && !access_or_warn(xdg_config, R_OK, 0)) {
@@ -663,12 +663,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)
@@ -681,19 +681,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);
 	}
@@ -707,10 +707,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) {
@@ -718,11 +718,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) :
@@ -823,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: %s", argv[0]);
+			die(_("no such section: %s"), argv[0]);
 	}
 	else if (actions == ACTION_REMOVE_SECTION) {
 		int ret;
@@ -834,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: %s", argv[0]);
+			die(_("no such section: %s"), argv[0]);
 	}
 	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.656.gda699b98b3


  parent reply	other threads:[~2018-07-21  7:50 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-18 16:10 [PATCH v2 00/23] Mark strings for translation Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 01/23] Update messages in preparation for i18n Nguyễn Thái Ngọc Duy
2018-07-19 18:18   ` Junio C Hamano
2018-07-19 18:29     ` Junio C Hamano
2018-07-21  7:37     ` Duy Nguyen
2018-07-18 16:10 ` [PATCH v2 02/23] archive-tar.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-07-19 18:21   ` Junio C Hamano
2018-07-21  6:18     ` Duy Nguyen
2018-07-18 16:10 ` [PATCH v2 03/23] archive-zip.c: " Nguyễn Thái Ngọc Duy
2018-07-19 18:26   ` Junio C Hamano
2018-07-19 18:48     ` Duy Nguyen
2018-07-19 19:30       ` Junio C Hamano
2018-07-18 16:10 ` [PATCH v2 04/23] builtin/config.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 05/23] builtin/grep.c: mark " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 06/23] builtin/pack-objects.c: mark more " Nguyễn Thái Ngọc Duy
2018-07-19 18:40   ` Junio C Hamano
2018-07-18 16:10 ` [PATCH v2 07/23] builtin/replace.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 08/23] commit-graph.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 09/23] config.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 10/23] connect.c: " Nguyễn Thái Ngọc Duy
2018-07-19 18:51   ` Junio C Hamano
2018-07-18 16:10 ` [PATCH v2 11/23] convert.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 12/23] dir.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 13/23] environment.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 14/23] exec-cmd.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 15/23] object.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 16/23] pkt-line.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 17/23] refs.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 18/23] refspec.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 19/23] replace-object.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 20/23] sequencer.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 21/23] sha1-file.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:11 ` [PATCH v2 22/23] transport.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:11 ` [PATCH v2 23/23] transport-helper.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49 ` [PATCH v3 00/23] Mark " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 01/23] Update messages in preparation for i18n Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 02/23] archive-tar.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 03/23] archive-zip.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` Nguyễn Thái Ngọc Duy [this message]
2018-07-21  7:49   ` [PATCH v3 05/23] builtin/grep.c: mark " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 06/23] builtin/pack-objects.c: mark more " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 07/23] builtin/replace.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 08/23] commit-graph.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 09/23] config.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 10/23] connect.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 11/23] convert.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 12/23] dir.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 13/23] environment.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 14/23] exec-cmd.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 15/23] object.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 16/23] pkt-line.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 17/23] refs.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 18/23] refspec.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 19/23] replace-object.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 20/23] sequencer.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 21/23] sha1-file.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 22/23] transport.c: " Nguyễn Thái Ngọc Duy
2018-07-21  7:49   ` [PATCH v3 23/23] transport-helper.c: " Nguyễn Thái Ngọc Duy

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180721074941.14632-5-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=stolee@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).