git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Vasco Almeida <vascomalmeida@sapo.pt>
To: git@vger.kernel.org
Cc: "Vasco Almeida" <vascomalmeida@sapo.pt>,
	"Jiang Xin" <worldhello.net@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 02/13] i18n: apply: mark error messages for translation
Date: Wed,  7 Sep 2016 14:49:06 +0000	[thread overview]
Message-ID: <1473259758-11836-2-git-send-email-vascomalmeida@sapo.pt> (raw)
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>

Mark error messages for translation passed to error() and die()
functions.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
 builtin/apply.c | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index ef03c74..ef2c084 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3065,8 +3065,8 @@ static int apply_binary_fragment(struct apply_state *state,
 	/* Binary patch is irreversible without the optional second hunk */
 	if (state->apply_in_reverse) {
 		if (!fragment->next)
-			return error("cannot reverse-apply a binary patch "
-				     "without the reverse hunk to '%s'",
+			return error(_("cannot reverse-apply a binary patch "
+				       "without the reverse hunk to '%s'"),
 				     patch->new_name
 				     ? patch->new_name : patch->old_name);
 		fragment = fragment->next;
@@ -3111,8 +3111,8 @@ static int apply_binary(struct apply_state *state,
 	    strlen(patch->new_sha1_prefix) != 40 ||
 	    get_sha1_hex(patch->old_sha1_prefix, sha1) ||
 	    get_sha1_hex(patch->new_sha1_prefix, sha1))
-		return error("cannot apply binary patch to '%s' "
-			     "without full index line", name);
+		return error(_("cannot apply binary patch to '%s' "
+			       "without full index line"), name);
 
 	if (patch->old_name) {
 		/*
@@ -3121,16 +3121,16 @@ static int apply_binary(struct apply_state *state,
 		 */
 		hash_sha1_file(img->buf, img->len, blob_type, sha1);
 		if (strcmp(sha1_to_hex(sha1), patch->old_sha1_prefix))
-			return error("the patch applies to '%s' (%s), "
-				     "which does not match the "
-				     "current contents.",
+			return error(_("the patch applies to '%s' (%s), "
+				       "which does not match the "
+				       "current contents."),
 				     name, sha1_to_hex(sha1));
 	}
 	else {
 		/* Otherwise, the old one must be empty. */
 		if (img->len)
-			return error("the patch applies to an empty "
-				     "'%s' but it is not empty", name);
+			return error(_("the patch applies to an empty "
+				       "'%s' but it is not empty"), name);
 	}
 
 	get_sha1_hex(patch->new_sha1_prefix, sha1);
@@ -3147,8 +3147,8 @@ static int apply_binary(struct apply_state *state,
 
 		result = read_sha1_file(sha1, &type, &size);
 		if (!result)
-			return error("the necessary postimage %s for "
-				     "'%s' cannot be read",
+			return error(_("the necessary postimage %s for "
+				       "'%s' cannot be read"),
 				     patch->new_sha1_prefix, name);
 		clear_image(img);
 		img->buf = result;
@@ -3523,7 +3523,7 @@ static int try_threeway(struct apply_state *state,
 		write_sha1_file("", 0, blob_type, pre_sha1);
 	else if (get_sha1(patch->old_sha1_prefix, pre_sha1) ||
 		 read_blob_object(&buf, pre_sha1, patch->old_mode))
-		return error("repository lacks the necessary blob to fall back on 3-way merge.");
+		return error(_("repository lacks the necessary blob to fall back on 3-way merge."));
 
 	fprintf(stderr, "Falling back to three-way merge...\n");
 
@@ -3541,11 +3541,11 @@ static int try_threeway(struct apply_state *state,
 	/* our_sha1[] is ours */
 	if (patch->is_new) {
 		if (load_current(state, &tmp_image, patch))
-			return error("cannot read the current contents of '%s'",
+			return error(_("cannot read the current contents of '%s'"),
 				     patch->new_name);
 	} else {
 		if (load_preimage(state, &tmp_image, patch, st, ce))
-			return error("cannot read the current contents of '%s'",
+			return error(_("cannot read the current contents of '%s'"),
 				     patch->old_name);
 	}
 	write_sha1_file(tmp_image.buf, tmp_image.len, blob_type, our_sha1);
@@ -4020,29 +4020,29 @@ static void build_fake_ancestor(struct patch *list, const char *filename)
 			if (!preimage_sha1_in_gitlink_patch(patch, sha1))
 				; /* ok, the textual part looks sane */
 			else
-				die("sha1 information is lacking or useless for submodule %s",
+				die(_("sha1 information is lacking or useless for submodule %s"),
 				    name);
 		} else if (!get_sha1_blob(patch->old_sha1_prefix, sha1)) {
 			; /* ok */
 		} else if (!patch->lines_added && !patch->lines_deleted) {
 			/* mode-only change: update the current */
 			if (get_current_sha1(patch->old_name, sha1))
-				die("mode change for %s, which is not "
-				    "in current HEAD", name);
+				die(_("mode change for %s, which is not "
+				    "in current HEAD"), name);
 		} else
-			die("sha1 information is lacking or useless "
-			    "(%s).", name);
+			die(_("sha1 information is lacking or useless "
+			    "(%s)."), name);
 
 		ce = make_cache_entry(patch->old_mode, sha1, name, 0, 0);
 		if (!ce)
 			die(_("make_cache_entry failed for path '%s'"), name);
 		if (add_index_entry(&result, ce, ADD_CACHE_OK_TO_ADD))
-			die ("Could not add %s to temporary index", name);
+			die(_("Could not add %s to temporary index"), name);
 	}
 
 	hold_lock_file_for_update(&lock, filename, LOCK_DIE_ON_ERROR);
 	if (write_locked_index(&result, &lock, COMMIT_LOCK))
-		die ("Could not write temporary index to %s", filename);
+		die(_("Could not write temporary index to %s"), filename);
 
 	discard_index(&result);
 }
@@ -4693,9 +4693,9 @@ static void check_apply_state(struct apply_state *state, int force_apply)
 	int is_not_gitdir = !startup_info->have_repository;
 
 	if (state->apply_with_reject && state->threeway)
-		die("--reject and --3way cannot be used together.");
+		die(_("--reject and --3way cannot be used together."));
 	if (state->cached && state->threeway)
-		die("--cached and --3way cannot be used together.");
+		die(_("--cached and --3way cannot be used together."));
 	if (state->threeway) {
 		if (is_not_gitdir)
 			die(_("--3way outside a repository"));
-- 
2.7.4


  reply	other threads:[~2016-09-07 14:50 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07 14:49 [PATCH 01/13] i18n: apply: mark plural string for translation Vasco Almeida
2016-09-07 14:49 ` Vasco Almeida [this message]
2016-09-07 14:49 ` [PATCH 03/13] i18n: apply: mark info messages " Vasco Almeida
2016-09-07 14:49 ` [PATCH 04/13] i18n: blame: mark error " Vasco Almeida
2016-09-10  9:41   ` Jean-Noël AVILA
2016-09-12 15:40     ` Junio C Hamano
2016-09-07 14:49 ` [PATCH 05/13] i18n: branch: mark option description " Vasco Almeida
2016-09-07 14:49 ` [PATCH 06/13] i18n: config: mark error message " Vasco Almeida
2016-09-07 14:49 ` [PATCH 07/13] i18n: merge-recursive: mark error messages " Vasco Almeida
2016-09-09 19:23   ` Junio C Hamano
2016-09-07 14:49 ` [PATCH 08/13] i18n: merge-recursive: mark verbose message " Vasco Almeida
2016-09-07 14:49 ` [PATCH 09/13] i18n: notes: mark error messages " Vasco Almeida
2016-09-07 14:49 ` [PATCH 10/13] notes: lowercase first word of error messages Vasco Almeida
2016-09-07 14:49 ` [PATCH 11/13] i18n: receive-pack: mark messages for translation Vasco Almeida
2016-09-07 14:49 ` [PATCH 12/13] i18n: show-branch: mark error " Vasco Almeida
2016-09-07 14:49 ` [PATCH 13/13] i18n: update-index: mark warning " Vasco Almeida
2016-09-07 14:49 ` [PATCH 13/13] i18n: update-index: mark warnings " Vasco Almeida
2016-09-08 20:45 ` [PATCH 01/13] i18n: apply: mark plural string " Junio C Hamano
2016-09-12 11:29 ` [PATCH v2 01/14] " Vasco Almeida
2016-09-12 11:29 ` [PATCH v2 02/14] i18n: apply: mark error messages " Vasco Almeida
2016-09-12 11:29 ` [PATCH v2 03/14] i18n: apply: mark info " Vasco Almeida
2016-09-12 11:29 ` [PATCH v2 04/14] i18n: blame: mark error " Vasco Almeida
2016-09-12 11:29 ` [PATCH v2 05/14] i18n: branch: mark option description " Vasco Almeida
2016-09-12 11:29 ` [PATCH v2 06/14] i18n: config: mark error message " Vasco Almeida
2016-09-12 11:29 ` [PATCH v2 07/14] i18n: merge-recursive: mark error messages " Vasco Almeida
2016-09-12 11:47   ` Jean-Noël Avila
2016-09-12 17:01     ` Junio C Hamano
2016-09-12 16:04   ` Junio C Hamano
2016-09-13 16:54     ` Vasco Almeida
2016-09-12 11:29 ` [PATCH v2 08/14] i18n: merge-recursive: mark verbose message " Vasco Almeida
2016-09-12 11:29 ` [PATCH v2 09/14] i18n: notes: mark error messages " Vasco Almeida
2016-09-12 12:23   ` Jean-Noël Avila
2016-09-13 16:35     ` Vasco Almeida
2016-09-13 20:23       ` Jean-Noël AVILA
2016-09-13 22:01         ` Junio C Hamano
2016-09-12 11:29 ` [PATCH v2 10/14] notes: lowercase first word of error messages Vasco Almeida
2016-09-12 11:29 ` [PATCH v2 11/14] i18n: receive-pack: mark messages for translation Vasco Almeida
2016-09-12 11:30 ` [PATCH v2 12/14] i18n: show-branch: mark error " Vasco Almeida
2016-09-12 12:12   ` Jean-Noël Avila
2016-09-12 17:02     ` Junio C Hamano
2016-09-12 17:19       ` Jean-Noël AVILA
2016-09-12 20:46         ` Junio C Hamano
2016-09-12 11:30 ` [PATCH v2 13/14] i18n: update-index: mark warnings " Vasco Almeida
2016-09-12 11:30 ` [PATCH v2 14/14] i18n: show-branch: mark plural strings " Vasco Almeida
2016-09-15 14:58 ` [PATCH v3 01/14] i18n: apply: mark plural string " Vasco Almeida
2016-09-15 14:58 ` [PATCH v3 02/14] i18n: apply: mark error messages " Vasco Almeida
2016-09-15 14:58 ` [PATCH v3 03/14] i18n: apply: mark info " Vasco Almeida
2016-09-15 14:58 ` [PATCH v3 04/14] i18n: blame: mark error " Vasco Almeida
2016-09-15 20:14   ` Junio C Hamano
2016-09-15 14:58 ` [PATCH v3 05/14] i18n: branch: mark option description " Vasco Almeida
2016-09-15 14:59 ` [PATCH v3 06/14] i18n: config: mark error message " Vasco Almeida
2016-09-15 14:59 ` [PATCH v3 07/14] i18n: merge-recursive: mark error messages " Vasco Almeida
2016-09-15 14:59 ` [PATCH v3 08/14] i18n: merge-recursive: mark verbose message " Vasco Almeida
2016-09-15 14:59 ` [PATCH v3 09/14] i18n: notes: mark error messages " Vasco Almeida
2016-09-15 14:59 ` [PATCH v3 10/14] notes: lowercase first word of error messages Vasco Almeida
2016-09-15 14:59 ` [PATCH v3 11/14] i18n: receive-pack: mark messages for translation Vasco Almeida
2016-09-15 14:59 ` [PATCH v3 12/14] i18n: show-branch: mark error " Vasco Almeida
2016-09-15 14:59 ` [PATCH v3 13/14] i18n: show-branch: mark plural strings " Vasco Almeida
2016-09-15 20:19   ` Junio C Hamano
2016-09-15 14:59 ` [PATCH v3 14/14] i18n: update-index: mark warnings " Vasco Almeida

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=1473259758-11836-2-git-send-email-vascomalmeida@sapo.pt \
    --to=vascomalmeida@sapo.pt \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=worldhello.net@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).