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

[PATCH 10/10] i18n: bundle: mark strings for translation

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Apr 23, 2012, 12:30 UTC
Message-ID
<1335184230-8870-11-git-send-email-pclouds@gmail.com>
In-Reply-To
<1335184230-8870-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 bundle.c |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/bundle.c b/bundle.c
index d9cfd90..6d21c77 100644
--- a/bundle.c
+++ b/bundle.c
@@ -33,7 +33,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header,
 	if (strbuf_getwholeline_fd(&buf, fd, '\n') ||
 	    strcmp(buf.buf, bundle_signature)) {
 		if (report_path)
-			error("'%s' does not look like a v2 bundle file",
+			error(_("'%s' does not look like a v2 bundle file"),
 			      report_path);
 		status = -1;
 		goto abort;
@@ -60,7 +60,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header,
 		    (40 <= buf.len && !isspace(buf.buf[40])) ||
 		    (!is_prereq && buf.len <= 40)) {
 			if (report_path)
-				error("unrecognized header: %s%s (%d)",
+				error(_("unrecognized header: %s%s (%d)"),
 				      (is_prereq ? "-" : ""), buf.buf, (int)buf.len);
 			status = -1;
 			break;
@@ -86,7 +86,7 @@ int read_bundle_header(const char *path, struct bundle_header *header)
 	int fd = open(path, O_RDONLY);
 
 	if (fd < 0)
-		return error("could not open '%s'", path);
+		return error(_("could not open '%s'"), path);
 	return parse_bundle_header(fd, header, path);
 }
 
@@ -137,7 +137,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
 	struct object_array refs;
 	struct commit *commit;
 	int i, ret = 0, req_nr;
-	const char *message = "Repository lacks these prerequisite commits:";
+	const char *message = _("Repository lacks these prerequisite commits:");
 
 	init_revisions(&revs, NULL);
 	for (i = 0; i < p->nr; i++) {
@@ -161,7 +161,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
 	revs.leak_pending = 1;
 
 	if (prepare_revision_walk(&revs))
-		die("revision walk setup failed");
+		die(_("revision walk setup failed"));
 
 	i = req_nr;
 	while (i && (commit = get_revision(&revs)))
@@ -183,12 +183,16 @@ int verify_bundle(struct bundle_header *header, int verbose)
 		struct ref_list *r;
 
 		r = &header->references;
-		printf("The bundle contains %d ref%s\n",
-		       r->nr, (1 < r->nr) ? "s" : "");
+		printf_ln(Q_("The bundle contains %d ref",
+			     "The bundle contains %d refs",
+			     r->nr),
+			  r->nr);
 		list_refs(r, 0, NULL);
 		r = &header->prerequisites;
-		printf("The bundle requires these %d ref%s\n",
-		       r->nr, (1 < r->nr) ? "s" : "");
+		printf_ln(Q_("The bundle requires this ref",
+			     "The bundle requires these %d refs",
+			     r->nr),
+			  r->nr);
 		list_refs(r, 0, NULL);
 	}
 	return ret;
@@ -283,13 +287,13 @@ int create_bundle(struct bundle_header *header, const char *path,
 	strbuf_release(&buf);
 	fclose(rls_fout);
 	if (finish_command(&rls))
-		return error("rev-list died");
+		return error(_("rev-list died"));
 
 	/* write references */
 	argc = setup_revisions(argc, argv, &revs, NULL);
 
 	if (argc > 1)
-		return error("unrecognized argument: %s'", argv[1]);
+		return error(_("unrecognized argument: %s'"), argv[1]);
 
 	object_array_remove_duplicates(&revs.pending);
 
@@ -324,7 +328,7 @@ int create_bundle(struct bundle_header *header, const char *path,
 		 * constraints.
 		 */
 		if (!(e->item->flags & SHOWN) && e->item->type == OBJ_COMMIT) {
-			warning("ref '%s' is excluded by the rev-list options",
+			warning(_("ref '%s' is excluded by the rev-list options"),
 				e->name);
 			free(ref);
 			continue;
@@ -369,7 +373,7 @@ int create_bundle(struct bundle_header *header, const char *path,
 		free(ref);
 	}
 	if (!ref_count)
-		die ("Refusing to create empty bundle.");
+		die(_("Refusing to create empty bundle."));
 
 	/* end header */
 	write_or_die(bundle_fd, "\n", 1);
@@ -387,7 +391,7 @@ int create_bundle(struct bundle_header *header, const char *path,
 	rls.out = bundle_fd;
 	rls.git_cmd = 1;
 	if (start_command(&rls))
-		return error("Could not spawn pack-objects");
+		return error(_("Could not spawn pack-objects"));
 
 	/*
 	 * start_command closed bundle_fd if it was > 1
@@ -405,10 +409,10 @@ int create_bundle(struct bundle_header *header, const char *path,
 	}
 	close(rls.in);
 	if (finish_command(&rls))
-		return error ("pack-objects died");
+		return error(_("pack-objects died"));
 	if (!bundle_to_stdout) {
 		if (commit_lock_file(&lock))
-			die_errno("cannot create '%s'", path);
+			die_errno(_("cannot create '%s'"), path);
 	}
 	return 0;
 }
@@ -430,6 +434,6 @@ int unbundle(struct bundle_header *header, int bundle_fd, int flags)
 	ip.no_stdout = 1;
 	ip.git_cmd = 1;
 	if (run_command(&ip))
-		return error("index-pack died");
+		return error(_("index-pack died"));
 	return 0;
 }
-- 
1.7.8.36.g69ee2
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 33 of 43 in “i18n relative dates, help, remote, apply, index-pack and bundle”
  1. 00/10 i18n relative dates, help, remote, apply, index-pack and bundleNguyễn Thái Ngọc Duy, Apr 23, 2012
  2. 01/10 Makefile: feed all header files to xgettextNguyễn Thái Ngọc Duy, Apr 23, 2012
  3. 02/10 Add three convenient format printing functions with \n automatically appendedNguyễn Thái Ngọc Duy, Apr 23, 2012
  4. Jonathan NiederApr 23, 2012
  5. 03/10 i18n: mark relative dates for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  6. Junio C HamanoApr 24, 2012
  7. Nguyen Thai Ngoc DuyApr 25, 2012
  8. Johannes SixtApr 25, 2012
  9. Zbigniew Jędrzejewski-SzmekApr 25, 2012
  10. Nguyen Thai Ngoc DuyApr 25, 2012
  11. Jonathan NiederApr 25, 2012
  12. Junio C HamanoApr 25, 2012
  13. Jonathan NiederApr 25, 2012
  14. 04/10 i18n: help: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  15. Jonathan NiederApr 23, 2012
  16. Junio C HamanoApr 23, 2012
  17. Jonathan NiederApr 23, 2012
  18. help: replace underlining "help -a" headers using hyphens with a blank lineNguyễn Thái Ngọc Duy, Apr 25, 2012
  19. Junio C HamanoApr 25, 2012
  20. 05/10 i18n: make warn_dangling_symref() automatically append \nNguyễn Thái Ngọc Duy, Apr 23, 2012
  21. 06/10 i18n: remote: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  22. Junio C HamanoApr 25, 2012
  23. Nguyen Thai Ngoc DuyApr 26, 2012
  24. 07/10 i18n: apply: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  25. Junio C HamanoApr 25, 2012
  26. apply: remove lego in i18n string in gitdiff_verify_nameNguyễn Thái Ngọc Duy, May 6, 2012
  27. Junio C HamanoMay 7, 2012
  28. apply: remove lego in i18n string in gitdiff_verify_nameNguyễn Thái Ngọc Duy, May 8, 2012
  29. Junio C HamanoMay 8, 2012
  30. apply: remove lego in i18n string in gitdiff_verify_nameNguyễn Thái Ngọc Duy, May 9, 2012
  31. 08/10 i18n: apply: update say_patch_name to give translators complete sentenceNguyễn Thái Ngọc Duy, Apr 23, 2012
  32. 09/10 i18n: index-pack: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  33. 10/10 i18n: bundle: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  34. Junio C HamanoApr 25, 2012
  35. Nguyen Thai Ngoc DuyApr 26, 2012
  36. bundle: remove stray single-quote from error messageJonathan Nieder, Apr 26, 2012
  37. Jonathan NiederApr 23, 2012
  38. Junio C HamanoApr 23, 2012
  39. Ævar Arnfjörð BjarmasonApr 23, 2012
  40. Nguyen Thai Ngoc DuyApr 24, 2012
  41. Junio C HamanoApr 24, 2012
  42. Nguyen Thai Ngoc DuyApr 25, 2012
  43. Jonathan NiederApr 25, 2012

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.