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, Eric Sunshine <sunshine@sunshineco.com>
Subject: [PATCH v2 10/23] connect.c: mark more strings for translation
Date: Sun,  3 Jun 2018 18:34:07 +0200	[thread overview]
Message-ID: <20180603163420.13702-11-pclouds@gmail.com> (raw)
In-Reply-To: <20180603163420.13702-1-pclouds@gmail.com>

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 connect.c             | 78 +++++++++++++++++++++++--------------------
 t/t5570-git-daemon.sh |  6 ++--
 2 files changed, 44 insertions(+), 40 deletions(-)

diff --git a/connect.c b/connect.c
index 083cf804a7..70b97cfef6 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,15 +635,16 @@ 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_ln(stderr, "done.");
-		fprintf(stderr, "Connecting to %s (port %s) ... ", host, port);
+		/* TRANSLATORS: this is the end of "Looking up %s ... " */
+		fprintf_ln(stderr, _("done."));
+		fprintf(stderr, _("Connecting to %s (port %s) ... "), host, port);
 	}
 
 	for (ai0 = ai; ai; ai = ai->ai_next, cnt++) {
@@ -666,12 +667,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);
 
@@ -698,23 +700,24 @@ 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_ln(stderr, "done.");
-		fprintf(stderr, "Connecting to %s (port %s) ... ", host, port);
+		/* TRANSLATORS: this is the end of "Looking up %s ... " */
+		fprintf_ln(stderr, _("done."));
+		fprintf(stderr, _("Connecting to %s (port %s) ... "), host, port);
 	}
 
 	for (cnt = 0, ap = he->h_addr_list; *ap; ap++, cnt++) {
@@ -743,12 +746,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;
 }
@@ -845,9 +849,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);
@@ -857,7 +861,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;
@@ -924,7 +928,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:
@@ -1119,7 +1123,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:
@@ -1131,7 +1135,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:
@@ -1148,7 +1152,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;
@@ -1171,7 +1175,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) {
@@ -1259,7 +1263,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, ' ');
@@ -1304,7 +1308,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.rc0.333.g22e6ee6cdf


  parent reply	other threads:[~2018-06-03 16:35 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-02  4:32 [PATCH 00/22] Mark more strings for translation Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 01/22] archive-tar.c: mark " Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 02/22] archive-zip.c: " Nguyễn Thái Ngọc Duy
2018-06-02  6:17   ` Duy Nguyen
2018-06-03 18:27     ` brian m. carlson
2018-06-02  4:32 ` [PATCH 03/22] builtin/config.c: " Nguyễn Thái Ngọc Duy
2018-06-03  9:01   ` Eric Sunshine
2018-06-03 15:00     ` Duy Nguyen
2018-06-02  4:32 ` [PATCH 04/22] builtin/grep.c: mark strings for translation and no full stops Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 05/22] builtin/pack-objects.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 06/22] builtin/replace.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:41   ` Eric Sunshine
2018-06-02  4:32 ` [PATCH 07/22] commit-graph.c: " Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 08/22] config.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:51   ` Eric Sunshine
2018-06-02  4:32 ` [PATCH 09/22] connect.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:55   ` Eric Sunshine
2018-06-02  4:32 ` [PATCH 10/22] convert.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:46   ` Eric Sunshine
2018-06-02  4:32 ` [PATCH 11/22] dir.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:47   ` Eric Sunshine
2018-06-02  4:32 ` [PATCH 12/22] environment.c: " Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 13/22] exec-cmd.c: " Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 14/22] object.c: " Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 15/22] pkt-line.c: " Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 16/22] refs.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:08   ` Eric Sunshine
2018-06-02  4:32 ` [PATCH 17/22] refspec.c: " Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 18/22] replace-object.c: " Nguyễn Thái Ngọc Duy
2018-06-02  4:32 ` [PATCH 19/22] sequencer.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:16   ` Eric Sunshine
2018-06-03 15:14     ` Duy Nguyen
2018-06-03 18:27       ` Eric Sunshine
2018-06-02  4:32 ` [PATCH 20/22] sha1-file.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:13   ` Eric Sunshine
2018-06-02  4:32 ` [PATCH 21/22] transport.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:29   ` Eric Sunshine
2018-06-03 15:17     ` Duy Nguyen
2018-06-02  4:32 ` [PATCH 22/22] transport-helper.c: " Nguyễn Thái Ngọc Duy
2018-06-03  8:32   ` Eric Sunshine
2018-06-03 16:33 ` [PATCH v2 00/23] Mark " Nguyễn Thái Ngọc Duy
2018-06-03 16:33   ` [PATCH v2 01/23] Update messages in preparation for i18n Nguyễn Thái Ngọc Duy
2018-06-03 16:33   ` [PATCH v2 02/23] archive-tar.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 03/23] archive-zip.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 04/23] builtin/config.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 05/23] builtin/grep.c: mark strings for translation and no full stops Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 06/23] builtin/pack-objects.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 07/23] builtin/replace.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 08/23] commit-graph.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 09/23] config.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` Nguyễn Thái Ngọc Duy [this message]
2018-06-03 16:34   ` [PATCH v2 11/23] convert.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 12/23] dir.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 13/23] environment.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 14/23] exec-cmd.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 15/23] object.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 16/23] pkt-line.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 17/23] refs.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 18/23] refspec.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 19/23] replace-object.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 20/23] sequencer.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 21/23] sha1-file.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 22/23] transport.c: " Nguyễn Thái Ngọc Duy
2018-06-03 16:34   ` [PATCH v2 23/23] transport-helper.c: " Nguyễn Thái Ngọc Duy
  -- strict thread matches above, loose matches on Subject: below --
2018-07-18 16:10 [PATCH v2 00/23] Mark " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 10/23] connect.c: mark more " Nguyễn Thái Ngọc Duy
2018-07-19 18:51   ` Junio C Hamano

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=20180603163420.13702-11-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.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).