From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 06/22] builtin/replace.c: mark more strings for translation
Date: Sat, 2 Jun 2018 06:32:25 +0200 [thread overview]
Message-ID: <20180602043241.9941-7-pclouds@gmail.com> (raw)
In-Reply-To: <20180602043241.9941-1-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
builtin/replace.c | 90 +++++++++++++++++++++++------------------------
1 file changed, 45 insertions(+), 45 deletions(-)
diff --git a/builtin/replace.c b/builtin/replace.c
index 6da2411e14..c203534fd3 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -54,7 +54,7 @@ static int show_reference(const char *refname, const struct object_id *oid,
enum object_type obj_type, repl_type;
if (get_oid(refname, &object))
- return error("Failed to resolve '%s' as a valid ref.", refname);
+ return error(_("failed to resolve '%s' as a valid ref"), refname);
obj_type = oid_object_info(the_repository, &object,
NULL);
@@ -83,8 +83,8 @@ static int list_replace_refs(const char *pattern, const char *format)
else if (!strcmp(format, "long"))
data.format = REPLACE_FORMAT_LONG;
else
- return error("invalid replace format '%s'\n"
- "valid formats are 'short', 'medium' and 'long'\n",
+ return error(_("invalid replace format '%s'\n"
+ "valid formats are 'short', 'medium' and 'long'"),
format);
for_each_replace_ref(the_repository, show_reference, (void *)&data);
@@ -108,7 +108,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)
for (p = argv; *p; p++) {
if (get_oid(*p, &oid)) {
- error("Failed to resolve '%s' as a valid ref.", *p);
+ error("failed to resolve '%s' as a valid ref", *p);
had_error = 1;
continue;
}
@@ -118,7 +118,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)
full_hex = ref.buf + base_len;
if (read_ref(ref.buf, &oid)) {
- error("replace ref '%s' not found.", full_hex);
+ error(_("replace ref '%s' not found"), full_hex);
had_error = 1;
continue;
}
@@ -134,7 +134,7 @@ static int delete_replace_ref(const char *name, const char *ref,
{
if (delete_ref(NULL, ref, oid, 0))
return 1;
- printf("Deleted replace ref '%s'\n", name);
+ printf_ln(_("Deleted replace ref '%s'"), name);
return 0;
}
@@ -146,12 +146,12 @@ static int check_ref_valid(struct object_id *object,
strbuf_reset(ref);
strbuf_addf(ref, "%s%s", git_replace_ref_base, oid_to_hex(object));
if (check_refname_format(ref->buf, 0))
- return error("'%s' is not a valid ref name.", ref->buf);
+ return error(_("'%s' is not a valid ref name"), ref->buf);
if (read_ref(ref->buf, prev))
oidclr(prev);
else if (!force)
- return error("replace ref '%s' already exists", ref->buf);
+ return error(_("replace ref '%s' already exists"), ref->buf);
return 0;
}
@@ -171,10 +171,10 @@ static int replace_object_oid(const char *object_ref,
obj_type = oid_object_info(the_repository, object, NULL);
repl_type = oid_object_info(the_repository, repl, NULL);
if (!force && obj_type != repl_type)
- return error("Objects must be of the same type.\n"
- "'%s' points to a replaced object of type '%s'\n"
- "while '%s' points to a replacement object of "
- "type '%s'.",
+ return error(_("objects must be of the same type.\n"
+ "'%s' points to a replaced object of type '%s'\n"
+ "while '%s' points to a replacement object of "
+ "type '%s'"),
object_ref, type_name(obj_type),
replace_ref, type_name(repl_type));
@@ -200,10 +200,10 @@ static int replace_object(const char *object_ref, const char *replace_ref, int f
struct object_id object, repl;
if (get_oid(object_ref, &object))
- return error("Failed to resolve '%s' as a valid ref.",
+ return error(_("failed to resolve '%s' as a valid ref"),
object_ref);
if (get_oid(replace_ref, &repl))
- return error("Failed to resolve '%s' as a valid ref.",
+ return error(_("failed to resolve '%s' as a valid ref"),
replace_ref);
return replace_object_oid(object_ref, &object, replace_ref, &repl, force);
@@ -222,7 +222,7 @@ static int export_object(const struct object_id *oid, enum object_type type,
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0)
- return error_errno("unable to open %s for writing", filename);
+ return error_errno(_("unable to open %s for writing"), filename);
argv_array_push(&cmd.args, "--no-replace-objects");
argv_array_push(&cmd.args, "cat-file");
@@ -235,7 +235,7 @@ static int export_object(const struct object_id *oid, enum object_type type,
cmd.out = fd;
if (run_command(&cmd))
- return error("cat-file reported failure");
+ return error(_("cat-file reported failure"));
return 0;
}
@@ -251,7 +251,7 @@ static int import_object(struct object_id *oid, enum object_type type,
fd = open(filename, O_RDONLY);
if (fd < 0)
- return error_errno("unable to open %s for reading", filename);
+ return error_errno(_("unable to open %s for reading"), filename);
if (!raw && type == OBJ_TREE) {
const char *argv[] = { "mktree", NULL };
@@ -265,11 +265,11 @@ static int import_object(struct object_id *oid, enum object_type type,
if (start_command(&cmd)) {
close(fd);
- return error("unable to spawn mktree");
+ return error(_("unable to spawn mktree"));
}
if (strbuf_read(&result, cmd.out, 41) < 0) {
- error_errno("unable to read from mktree");
+ error_errno(_("unable to read from mktree"));
close(fd);
close(cmd.out);
return -1;
@@ -278,11 +278,11 @@ static int import_object(struct object_id *oid, enum object_type type,
if (finish_command(&cmd)) {
strbuf_release(&result);
- return error("mktree reported failure");
+ return error(_("mktree reported failure"));
}
if (get_oid_hex(result.buf, oid) < 0) {
strbuf_release(&result);
- return error("mktree did not return an object name");
+ return error(_("mktree did not return an object name"));
}
strbuf_release(&result);
@@ -291,12 +291,12 @@ static int import_object(struct object_id *oid, enum object_type type,
int flags = HASH_FORMAT_CHECK | HASH_WRITE_OBJECT;
if (fstat(fd, &st) < 0) {
- error_errno("unable to fstat %s", filename);
+ error_errno(_("unable to fstat %s"), filename);
close(fd);
return -1;
}
if (index_fd(oid, fd, &st, type, NULL, flags) < 0)
- return error("unable to write object to database");
+ return error(_("unable to write object to database"));
/* index_fd close()s fd for us */
}
@@ -315,11 +315,11 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
struct strbuf ref = STRBUF_INIT;
if (get_oid(object_ref, &old_oid) < 0)
- return error("Not a valid object name: '%s'", object_ref);
+ return error(_("not a valid object name: '%s'"), object_ref);
type = oid_object_info(the_repository, &old_oid, NULL);
if (type < 0)
- return error("unable to get object type for %s",
+ return error(_("unable to get object type for %s"),
oid_to_hex(&old_oid));
if (check_ref_valid(&old_oid, &prev, &ref, force)) {
@@ -335,7 +335,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
}
if (launch_editor(tmpfile, NULL, NULL) < 0) {
free(tmpfile);
- return error("editing object file failed");
+ return error(_("editing object file failed"));
}
if (import_object(&new_oid, type, raw, tmpfile)) {
free(tmpfile);
@@ -344,7 +344,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
free(tmpfile);
if (!oidcmp(&old_oid, &new_oid))
- return error("new object is the same as the old one: '%s'", oid_to_hex(&old_oid));
+ return error(_("new object is the same as the old one: '%s'"), oid_to_hex(&old_oid));
return replace_object_oid(object_ref, &old_oid, "replacement", &new_oid, force);
}
@@ -368,7 +368,7 @@ static int replace_parents(struct strbuf *buf, int argc, const char **argv)
struct object_id oid;
if (get_oid(argv[i], &oid) < 0) {
strbuf_release(&new_parents);
- return error(_("Not a valid object name: '%s'"),
+ return error(_("not a valid object name: '%s'"),
argv[i]);
}
if (!lookup_commit_reference(&oid)) {
@@ -412,7 +412,7 @@ static int check_one_mergetag(struct commit *commit,
for (i = 1; i < mergetag_data->argc; i++) {
struct object_id oid;
if (get_oid(mergetag_data->argv[i], &oid) < 0)
- return error(_("Not a valid object name: '%s'"),
+ return error(_("not a valid object name: '%s'"),
mergetag_data->argv[i]);
if (!oidcmp(&tag->tagged->oid, &oid))
return 0; /* found */
@@ -442,7 +442,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
unsigned long size;
if (get_oid(old_ref, &old_oid) < 0)
- return error(_("Not a valid object name: '%s'"), old_ref);
+ return error(_("not a valid object name: '%s'"), old_ref);
commit = lookup_commit_reference(&old_oid);
if (!commit)
return error(_("could not parse %s"), old_ref);
@@ -456,10 +456,10 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
return -1;
}
- if (remove_signature(&buf)) {
- warning(_("the original commit '%s' has a gpg signature."), old_ref);
- warning(_("the signature will be removed in the replacement commit!"));
- }
+ if (remove_signature(&buf))
+ warning(_("the original commit '%s' has a gpg signature.\n"
+ "The signature will be removed in the replacement commit!"),
+ old_ref);
if (check_mergetags(commit, argc, argv)) {
strbuf_release(&buf);
@@ -476,10 +476,10 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
if (!oidcmp(&old_oid, &new_oid)) {
if (gentle) {
- warning("graft for '%s' unnecessary", oid_to_hex(&old_oid));
+ warning(_("graft for '%s' unnecessary"), oid_to_hex(&old_oid));
return 0;
}
- return error("new commit is the same as the old one: '%s'", oid_to_hex(&old_oid));
+ return error(_("new commit is the same as the old one: '%s'"), oid_to_hex(&old_oid));
}
return replace_object_oid(old_ref, &old_oid, "replacement", &new_oid, force);
@@ -553,7 +553,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
cmdmode = argc ? MODE_REPLACE : MODE_LIST;
if (format && cmdmode != MODE_LIST)
- usage_msg_opt("--format cannot be used when not listing",
+ usage_msg_opt(_("--format cannot be used when not listing"),
git_replace_usage, options);
if (force &&
@@ -561,47 +561,47 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
cmdmode != MODE_EDIT &&
cmdmode != MODE_GRAFT &&
cmdmode != MODE_CONVERT_GRAFT_FILE)
- usage_msg_opt("-f only makes sense when writing a replacement",
+ usage_msg_opt(_("-f only makes sense when writing a replacement"),
git_replace_usage, options);
if (raw && cmdmode != MODE_EDIT)
- usage_msg_opt("--raw only makes sense with --edit",
+ usage_msg_opt(_("--raw only makes sense with --edit"),
git_replace_usage, options);
switch (cmdmode) {
case MODE_DELETE:
if (argc < 1)
- usage_msg_opt("-d needs at least one argument",
+ usage_msg_opt(_("-d needs at least one argument"),
git_replace_usage, options);
return for_each_replace_name(argv, delete_replace_ref);
case MODE_REPLACE:
if (argc != 2)
- usage_msg_opt("bad number of arguments",
+ usage_msg_opt(_("bad number of arguments"),
git_replace_usage, options);
return replace_object(argv[0], argv[1], force);
case MODE_EDIT:
if (argc != 1)
- usage_msg_opt("-e needs exactly one argument",
+ usage_msg_opt(_("-e needs exactly one argument"),
git_replace_usage, options);
return edit_and_replace(argv[0], force, raw);
case MODE_GRAFT:
if (argc < 1)
- usage_msg_opt("-g needs at least one argument",
+ usage_msg_opt(_("-g needs at least one argument"),
git_replace_usage, options);
return create_graft(argc, argv, force, 0);
case MODE_CONVERT_GRAFT_FILE:
if (argc != 0)
- usage_msg_opt("--convert-graft-file takes no argument",
+ usage_msg_opt(_("--convert-graft-file takes no argument"),
git_replace_usage, options);
return !!convert_graft_file(force);
case MODE_LIST:
if (argc > 1)
- usage_msg_opt("only one pattern can be given with -l",
+ usage_msg_opt(_("only one pattern can be given with -l"),
git_replace_usage, options);
return list_replace_refs(argv[0], format);
--
2.18.0.rc0.309.g77c7720784
next prev parent reply other threads:[~2018-06-02 4:33 UTC|newest]
Thread overview: 64+ 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 ` Nguyễn Thái Ngọc Duy [this message]
2018-06-03 8:41 ` [PATCH 06/22] builtin/replace.c: " 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 ` [PATCH v2 10/23] connect.c: " Nguyễn Thái Ngọc Duy
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
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=20180602043241.9941-7-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
/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).