i18n: git-tag basic messages
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Feb 22, 2011 at 23:42 UTC
d08ebf9972ec890bf1ebea802bb2590784a1199c
1 file changed
+30
-30
builtin/tag.c
+30
-30
@@ -118,12 +118,12 @@ static int for_each_tag_name(const char **argv, each_tag_name_fn fn)
118
for (p = argv; *p; p++) {
119
if (snprintf(ref, sizeof(ref), "refs/tags/%s", *p)
120
>= sizeof(ref)) {
121
- error("tag name too long: %.*s...", 50, *p);
121
+ error(_("tag name too long: %.*s..."), 50, *p);
122
had_error = 1;
123
continue;
124
}
125
if (!resolve_ref(ref, sha1, 1, NULL)) {
126
- error("tag '%s' not found.", *p);
126
+ error(_("tag '%s' not found."), *p);
127
had_error = 1;
128
continue;
129
}
@@ -138,7 +138,7 @@ static int delete_tag(const char *name, const char *ref,
138
{
139
if (delete_ref(ref, sha1, 0))
140
return 1;
141
- printf("Deleted tag '%s' (was %s)\n", name, find_unique_abbrev(sha1, DEFAULT_ABBREV));
141
+ printf(_("Deleted tag '%s' (was %s)\n"), name, find_unique_abbrev(sha1, DEFAULT_ABBREV));
142
return 0;
143
}
144
@@ -150,7 +150,7 @@ static int verify_tag(const char *name, const char *ref,
150
argv_verify_tag[2] = sha1_to_hex(sha1);
151
152
if (run_command_v_opt(argv_verify_tag, RUN_GIT_CMD))
153
- return error("could not verify the tag '%s'", name);
153
+ return error(_("could not verify the tag '%s'"), name);
154
return 0;
155
}
156
@@ -165,7 +165,7 @@ static int do_sign(struct strbuf *buffer)
165
if (!*signingkey) {
166
if (strlcpy(signingkey, git_committer_info(IDENT_ERROR_ON_NO_NAME),
167
sizeof(signingkey)) > sizeof(signingkey) - 1)
168
- return error("committer info too long.");
168
+ return error(_("committer info too long."));
169
bracket = strchr(signingkey, '>');
170
if (bracket)
171
bracket[1] = '\0';
@@ -185,20 +185,20 @@ static int do_sign(struct strbuf *buffer)
185
args[3] = NULL;
186
187
if (start_command(&gpg))
188
- return error("could not run gpg.");
188
+ return error(_("could not run gpg."));
189
190
if (write_in_full(gpg.in, buffer->buf, buffer->len) != buffer->len) {
191
close(gpg.in);
192
close(gpg.out);
193
finish_command(&gpg);
194
- return error("gpg did not accept the tag data");
194
+ return error(_("gpg did not accept the tag data"));
195
}
196
close(gpg.in);
197
len = strbuf_read(buffer, gpg.out, 1024);
198
close(gpg.out);
199
200
if (finish_command(&gpg) || !len || len < 0)
201
- return error("gpg failed to sign the tag");
201
+ return error(_("gpg failed to sign the tag"));
202
203
/* Strip CR from the line endings, in case we are on Windows. */
204
for (i = j = 0; i < buffer->len; i++)
@@ -221,7 +221,7 @@ static const char tag_template[] =
221
static void set_signingkey(const char *value)
222
{
223
if (strlcpy(signingkey, value, sizeof(signingkey)) >= sizeof(signingkey))
224
- die("signing key value too long (%.10s...)", value);
224
+ die(_("signing key value too long (%.10s...)"), value);
225
}
226
227
static int git_tag_config(const char *var, const char *value, void *cb)
@@ -261,9 +261,9 @@ static void write_tag_body(int fd, const unsigned char *sha1)
261
static int build_tag_object(struct strbuf *buf, int sign, unsigned char *result)
262
{
263
if (sign && do_sign(buf) < 0)
264
- return error("unable to sign the tag");
264
+ return error(_("unable to sign the tag"));
265
if (write_sha1_file(buf->buf, buf->len, tag_type, result) < 0)
266
- return error("unable to write tag file");
266
+ return error(_("unable to write tag file"));
267
return 0;
268
}
269
@@ -278,7 +278,7 @@ static void create_tag(const unsigned char *object, const char *tag,
278
279
type = sha1_object_info(object, NULL);
280
if (type <= OBJ_NONE)
281
- die("bad object type.");
281
+ die(_("bad object type."));
282
283
header_len = snprintf(header_buf, sizeof(header_buf),
284
"object %s\n"
@@ -291,7 +291,7 @@ static void create_tag(const unsigned char *object, const char *tag,
291
git_committer_info(IDENT_ERROR_ON_NO_NAME));
292
293
if (header_len > sizeof(header_buf) - 1)
294
- die("tag header too big.");
294
+ die(_("tag header too big."));
295
296
if (!message) {
297
int fd;
@@ -300,7 +300,7 @@ static void create_tag(const unsigned char *object, const char *tag,
300
path = git_pathdup("TAG_EDITMSG");
301
fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
302
if (fd < 0)
303
- die_errno("could not create file '%s'", path);
303
+ die_errno(_("could not create file '%s'"), path);
304
305
if (!is_null_sha1(prev))
306
write_tag_body(fd, prev);
@@ -310,7 +310,7 @@ static void create_tag(const unsigned char *object, const char *tag,
310
311
if (launch_editor(path, buf, NULL)) {
312
fprintf(stderr,
313
- "Please supply the message using either -m or -F option.\n");
313
+ _("Please supply the message using either -m or -F option.\n"));
314
exit(1);
315
}
316
}
@@ -318,13 +318,13 @@ static void create_tag(const unsigned char *object, const char *tag,
318
stripspace(buf, 1);
319
320
if (!message && !buf->len)
321
- die("no tag message?");
321
+ die(_("no tag message?"));
322
323
strbuf_insert(buf, 0, header_buf, header_len);
324
325
if (build_tag_object(buf, sign, result) < 0) {
326
if (path)
327
- fprintf(stderr, "The tag message has been left in %s\n",
327
+ fprintf(stderr, _("The tag message has been left in %s\n"),
328
path);
329
exit(128);
330
}
@@ -417,9 +417,9 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
417
return list_tags(argv[0], lines == -1 ? 0 : lines,
418
with_commit);
419
if (lines != -1)
420
- die("-n option is only allowed with -l.");
420
+ die(_("-n option is only allowed with -l."));
421
if (with_commit)
422
- die("--contains option is only allowed with -l.");
422
+ die(_("--contains option is only allowed with -l."));
423
if (delete)
424
return for_each_tag_name(argv, delete_tag);
425
if (verify)
@@ -427,17 +427,17 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
427
428
if (msg.given || msgfile) {
429
if (msg.given && msgfile)
430
- die("only one -F or -m option is allowed.");
430
+ die(_("only one -F or -m option is allowed."));
431
annotate = 1;
432
if (msg.given)
433
strbuf_addbuf(&buf, &(msg.buf));
434
else {
435
if (!strcmp(msgfile, "-")) {
436
if (strbuf_read(&buf, 0, 1024) < 0)
437
- die_errno("cannot read '%s'", msgfile);
437
+ die_errno(_("cannot read '%s'"), msgfile);
438
} else {
439
if (strbuf_read_file(&buf, msgfile, 1024) < 0)
440
- die_errno("could not open or read '%s'",
440
+ die_errno(_("could not open or read '%s'"),
441
msgfile);
442
}
443
}
@@ -447,20 +447,20 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
447
448
object_ref = argc == 2 ? argv[1] : "HEAD";
449
if (argc > 2)
450
- die("too many params");
450
+ die(_("too many params"));
451
452
if (get_sha1(object_ref, object))
453
- die("Failed to resolve '%s' as a valid ref.", object_ref);
453
+ die(_("Failed to resolve '%s' as a valid ref."), object_ref);
454
455
if (snprintf(ref, sizeof(ref), "refs/tags/%s", tag) > sizeof(ref) - 1)
456
- die("tag name too long: %.*s...", 50, tag);
456
+ die(_("tag name too long: %.*s..."), 50, tag);
457
if (check_ref_format(ref))
458
- die("'%s' is not a valid tag name.", tag);
458
+ die(_("'%s' is not a valid tag name."), tag);
459
460
if (!resolve_ref(ref, prev, 1, NULL))
461
hashclr(prev);
462
else if (!force)
463
- die("tag '%s' already exists", tag);
463
+ die(_("tag '%s' already exists"), tag);
464
465
if (annotate)
466
create_tag(object, tag, &buf, msg.given || msgfile,
@@ -468,11 +468,11 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
468
469
lock = lock_any_ref_for_update(ref, prev, 0);
470
if (!lock)
471
- die("%s: cannot lock the ref", ref);
471
+ die(_("%s: cannot lock the ref"), ref);
472
if (write_ref_sha1(lock, object, NULL) < 0)
473
- die("%s: cannot update the ref", ref);
473
+ die(_("%s: cannot update the ref"), ref);
474
if (force && hashcmp(prev, object))
475
- printf("Updated tag '%s' (was %s)\n", tag, find_unique_abbrev(prev, DEFAULT_ABBREV));
475
+ printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev, DEFAULT_ABBREV));
476
477
strbuf_release(&buf);
478
return 0;