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 10/23] connect.c: mark more strings for translation
Date: Sat, 21 Jul 2018 09:49:28 +0200	[thread overview]
Message-ID: <20180721074941.14632-11-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>
---
 connect.c             | 74 +++++++++++++++++++++++--------------------
 t/t5570-git-daemon.sh |  6 ++--
 2 files changed, 42 insertions(+), 38 deletions(-)

diff --git a/connect.c b/connect.c
index 308475b7eb..94547e5056 100644
--- a/connect.c
+++ b/connect.c
@@ -78,7 +78,7 @@ int server_supports_v2(const char *c, int die_on_error)
 	}
 
 	if (die_on_error)
-		die("server doesn't support '%s'", c);
+		die(_("server doesn't support '%s'"), c);
 
 	return 0;
 }
@@ -100,7 +100,7 @@ int server_supports_feature(const char *c, const char *feature,
 	}
 
 	if (die_on_error)
-		die("server doesn't support feature '%s'", feature);
+		die(_("server doesn't support feature '%s'"), feature);
 
 	return 0;
 }
@@ -111,7 +111,7 @@ static void process_capabilities_v2(struct packet_reader *reader)
 		argv_array_push(&server_capabilities_v2, reader->line);
 
 	if (reader->status != PACKET_READ_FLUSH)
-		die("expected flush after capabilities");
+		die(_("expected flush after capabilities"));
 }
 
 enum protocol_version discover_version(struct packet_reader *reader)
@@ -230,7 +230,7 @@ static int process_dummy_ref(const char *line)
 static void check_no_capabilities(const char *line, int len)
 {
 	if (strlen(line) != len)
-		warning("ignoring capabilities after first line '%s'",
+		warning(_("ignoring capabilities after first line '%s'"),
 			line + strlen(line));
 }
 
@@ -249,7 +249,7 @@ static int process_ref(const char *line, int len, struct ref ***list,
 	if (extra_have && !strcmp(name, ".have")) {
 		oid_array_append(extra_have, &old_oid);
 	} else if (!strcmp(name, "capabilities^{}")) {
-		die("protocol error: unexpected capabilities^{}");
+		die(_("protocol error: unexpected capabilities^{}"));
 	} else if (check_ref(name, flags)) {
 		struct ref *ref = alloc_ref(name);
 		oidcpy(&ref->old_oid, &old_oid);
@@ -270,9 +270,9 @@ static int process_shallow(const char *line, int len,
 		return 0;
 
 	if (get_oid_hex(arg, &old_oid))
-		die("protocol error: expected shallow sha-1, got '%s'", arg);
+		die(_("protocol error: expected shallow sha-1, got '%s'"), arg);
 	if (!shallow_points)
-		die("repository on the other end cannot be shallow");
+		die(_("repository on the other end cannot be shallow"));
 	oid_array_append(shallow_points, &old_oid);
 	check_no_capabilities(line, len);
 	return 1;
@@ -307,13 +307,13 @@ struct ref **get_remote_heads(struct packet_reader *reader,
 		case PACKET_READ_NORMAL:
 			len = reader->pktlen;
 			if (len > 4 && skip_prefix(reader->line, "ERR ", &arg))
-				die("remote error: %s", arg);
+				die(_("remote error: %s"), arg);
 			break;
 		case PACKET_READ_FLUSH:
 			state = EXPECTING_DONE;
 			break;
 		case PACKET_READ_DELIM:
-			die("invalid packet");
+			die(_("invalid packet"));
 		}
 
 		switch (state) {
@@ -333,7 +333,7 @@ struct ref **get_remote_heads(struct packet_reader *reader,
 		case EXPECTING_SHALLOW:
 			if (process_shallow(reader->line, len, shallow_points))
 				break;
-			die("protocol error: unexpected '%s'", reader->line);
+			die(_("protocol error: unexpected '%s'"), reader->line);
 		case EXPECTING_DONE:
 			break;
 		}
@@ -441,11 +441,11 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
 	/* Process response from server */
 	while (packet_reader_read(reader) == PACKET_READ_NORMAL) {
 		if (!process_ref_v2(reader->line, &list))
-			die("invalid ls-refs response: %s", reader->line);
+			die(_("invalid ls-refs response: %s"), reader->line);
 	}
 
 	if (reader->status != PACKET_READ_FLUSH)
-		die("expected flush after ref listing");
+		die(_("expected flush after ref listing"));
 
 	return list;
 }
@@ -544,7 +544,7 @@ static enum protocol get_protocol(const char *name)
 		return PROTO_SSH;
 	if (!strcmp(name, "file"))
 		return PROTO_FILE;
-	die("protocol '%s' is not supported", name);
+	die(_("protocol '%s' is not supported"), name);
 }
 
 static char *host_end(char **hoststart, int removebrackets)
@@ -595,7 +595,7 @@ static void enable_keepalive(int sockfd)
 	int ka = 1;
 
 	if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0)
-		error_errno("unable to set SO_KEEPALIVE on socket");
+		error_errno(_("unable to set SO_KEEPALIVE on socket"));
 }
 
 #ifndef NO_IPV6
@@ -635,14 +635,15 @@ static int git_tcp_connect_sock(char *host, int flags)
 	hints.ai_protocol = IPPROTO_TCP;
 
 	if (flags & CONNECT_VERBOSE)
-		fprintf(stderr, "Looking up %s ... ", host);
+		fprintf(stderr, _("Looking up %s ... "), host);
 
 	gai = getaddrinfo(host, port, &hints, &ai);
 	if (gai)
-		die("unable to look up %s (port %s) (%s)", host, port, gai_strerror(gai));
+		die(_("unable to look up %s (port %s) (%s)"), host, port, gai_strerror(gai));
 
 	if (flags & CONNECT_VERBOSE)
-		fprintf(stderr, "done.\nConnecting to %s (port %s) ... ", host, port);
+		/* TRANSLATORS: this is the end of "Looking up %s ... " */
+		fprintf(stderr, _("done.\nConnecting to %s (port %s) ... "), host, port);
 
 	for (ai0 = ai; ai; ai = ai->ai_next, cnt++) {
 		sockfd = socket(ai->ai_family,
@@ -664,12 +665,13 @@ static int git_tcp_connect_sock(char *host, int flags)
 	freeaddrinfo(ai0);
 
 	if (sockfd < 0)
-		die("unable to connect to %s:\n%s", host, error_message.buf);
+		die(_("unable to connect to %s:\n%s"), host, error_message.buf);
 
 	enable_keepalive(sockfd);
 
 	if (flags & CONNECT_VERBOSE)
-		fprintf_ln(stderr, "done.");
+		/* TRANSLATORS: this is the end of "Connecting to %s (port %s) ... " */
+		fprintf_ln(stderr, _("done."));
 
 	strbuf_release(&error_message);
 
@@ -696,22 +698,23 @@ static int git_tcp_connect_sock(char *host, int flags)
 	get_host_and_port(&host, &port);
 
 	if (flags & CONNECT_VERBOSE)
-		fprintf(stderr, "Looking up %s ... ", host);
+		fprintf(stderr, _("Looking up %s ... "), host);
 
 	he = gethostbyname(host);
 	if (!he)
-		die("unable to look up %s (%s)", host, hstrerror(h_errno));
+		die(_("unable to look up %s (%s)"), host, hstrerror(h_errno));
 	nport = strtoul(port, &ep, 10);
 	if ( ep == port || *ep ) {
 		/* Not numeric */
 		struct servent *se = getservbyname(port,"tcp");
 		if ( !se )
-			die("unknown port %s", port);
+			die(_("unknown port %s"), port);
 		nport = se->s_port;
 	}
 
 	if (flags & CONNECT_VERBOSE)
-		fprintf(stderr, "done.\nConnecting to %s (port %s) ... ", host, port);
+		/* TRANSLATORS: this is the end of "Looking up %s ... " */
+		fprintf(stderr, _("done.\nConnecting to %s (port %s) ... "), host, port);
 
 	for (cnt = 0, ap = he->h_addr_list; *ap; ap++, cnt++) {
 		memset(&sa, 0, sizeof sa);
@@ -739,12 +742,13 @@ static int git_tcp_connect_sock(char *host, int flags)
 	}
 
 	if (sockfd < 0)
-		die("unable to connect to %s:\n%s", host, error_message.buf);
+		die(_("unable to connect to %s:\n%s"), host, error_message.buf);
 
 	enable_keepalive(sockfd);
 
 	if (flags & CONNECT_VERBOSE)
-		fprintf_ln(stderr, "done.");
+		/* TRANSLATORS: this is the end of "Connecting to %s (port %s) ... " */
+		fprintf_ln(stderr, _("done."));
 
 	return sockfd;
 }
@@ -841,9 +845,9 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
 	get_host_and_port(&host, &port);
 
 	if (looks_like_command_line_option(host))
-		die("strange hostname '%s' blocked", host);
+		die(_("strange hostname '%s' blocked"), host);
 	if (looks_like_command_line_option(port))
-		die("strange port '%s' blocked", port);
+		die(_("strange port '%s' blocked"), port);
 
 	proxy = xmalloc(sizeof(*proxy));
 	child_process_init(proxy);
@@ -853,7 +857,7 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
 	proxy->in = -1;
 	proxy->out = -1;
 	if (start_command(proxy))
-		die("cannot start proxy %s", git_proxy_command);
+		die(_("cannot start proxy %s"), git_proxy_command);
 	fd[0] = proxy->out; /* read from proxy stdout */
 	fd[1] = proxy->in;  /* write to proxy stdin */
 	return proxy;
@@ -920,7 +924,7 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
 		path = strchr(end, separator);
 
 	if (!path || !*path)
-		die("no path specified; see 'git help pull' for valid url syntax");
+		die(_("no path specified; see 'git help pull' for valid url syntax"));
 
 	/*
 	 * null-terminate hostname and point path to ~ for URL's like this:
@@ -1115,7 +1119,7 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
 		case VARIANT_AUTO:
 			BUG("VARIANT_AUTO passed to push_ssh_options");
 		case VARIANT_SIMPLE:
-			die("ssh variant 'simple' does not support -4");
+			die(_("ssh variant 'simple' does not support -4"));
 		case VARIANT_SSH:
 		case VARIANT_PLINK:
 		case VARIANT_PUTTY:
@@ -1127,7 +1131,7 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
 		case VARIANT_AUTO:
 			BUG("VARIANT_AUTO passed to push_ssh_options");
 		case VARIANT_SIMPLE:
-			die("ssh variant 'simple' does not support -6");
+			die(_("ssh variant 'simple' does not support -6"));
 		case VARIANT_SSH:
 		case VARIANT_PLINK:
 		case VARIANT_PUTTY:
@@ -1144,7 +1148,7 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
 		case VARIANT_AUTO:
 			BUG("VARIANT_AUTO passed to push_ssh_options");
 		case VARIANT_SIMPLE:
-			die("ssh variant 'simple' does not support setting port");
+			die(_("ssh variant 'simple' does not support setting port"));
 		case VARIANT_SSH:
 			argv_array_push(args, "-p");
 			break;
@@ -1167,7 +1171,7 @@ static void fill_ssh_args(struct child_process *conn, const char *ssh_host,
 	enum ssh_variant variant;
 
 	if (looks_like_command_line_option(ssh_host))
-		die("strange hostname '%s' blocked", ssh_host);
+		die(_("strange hostname '%s' blocked"), ssh_host);
 
 	ssh = get_ssh_command();
 	if (ssh) {
@@ -1255,7 +1259,7 @@ struct child_process *git_connect(int fd[2], const char *url,
 		child_process_init(conn);
 
 		if (looks_like_command_line_option(path))
-			die("strange pathname '%s' blocked", path);
+			die(_("strange pathname '%s' blocked"), path);
 
 		strbuf_addstr(&cmd, prog);
 		strbuf_addch(&cmd, ' ');
@@ -1300,7 +1304,7 @@ struct child_process *git_connect(int fd[2], const char *url,
 		argv_array_push(&conn->args, cmd.buf);
 
 		if (start_command(conn))
-			die("unable to fork");
+			die(_("unable to fork"));
 
 		fd[0] = conn->out; /* read from child's stdout */
 		fd[1] = conn->in;  /* write to child's stdin */
diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
index 0d4c52016b..a571f22bfd 100755
--- a/t/t5570-git-daemon.sh
+++ b/t/t5570-git-daemon.sh
@@ -7,9 +7,9 @@ test_description='test fetching over git protocol'
 start_git_daemon
 
 check_verbose_connect () {
-	grep -F "Looking up 127.0.0.1 ..." stderr &&
-	grep -F "Connecting to 127.0.0.1 (port " stderr &&
-	grep -F "done." stderr
+	test_i18ngrep -F "Looking up 127.0.0.1 ..." stderr &&
+	test_i18ngrep -F "Connecting to 127.0.0.1 (port " stderr &&
+	test_i18ngrep -F "done." stderr
 }
 
 test_expect_success 'setup repository' '
-- 
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   ` [PATCH v3 04/23] builtin/config.c: " Nguyễn Thái Ngọc Duy
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   ` Nguyễn Thái Ngọc Duy [this message]
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-11-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).